The Student Room Group

Help how'd u do this ?

A function is defined as follows:

function sequence(n)
while n != 1:
output n
if n MOD 2 == 0 then
n = n DIV 2
else
n = 3*n + 1
end if
end while
output n

Write down the output from calling sequence(3)
Reply 1
thx should have pm'd u i thought it was just 10
Reply 2
do i write each output or just the last
Reply 3
2 marks
Reply 4
i can't it's a pixl test so..
Reply 5
ok thank you so much i feel like im gonna be asking u for help alot this year

Quick Reply

Latest

Trending

Trending