Ask your own question, for FREE!
Computer Science 44 Online
OpenStudy (anonymous):

hi what do they mean by while(n>1) { if (n is even) n:=n/2 else n:=3*n+1 }

OpenStudy (anonymous):

@Opcode

OpenStudy (anonymous):

while (n > 1){ (n is even) n : n /2 else n :=3*n+1 }

OpenStudy (anonymous):

@Hero

OpenStudy (anonymous):

@ZeHanz

OpenStudy (anonymous):

actually i want to know :=

OpenStudy (zehanz):

If you have a number n that is larger than 1, do the following: As long it is even (i.e. it has at least one factor 2), then divide it by 2. So all factors 2 are divided out. After this, and if this n without any factors 2 is still larger than 1, multiply it with 3 and add 1. Let's try a number, say n=20 (=2*2*5) The two factors 2 are removed, leaving n=5. Now this becomes 16. (3*5+1). Another number: n=2*2*2*3*5=120. This is converted to 15. Then it becomes 46. I have no idea what is the use for this...

OpenStudy (anonymous):

n is assigned to

OpenStudy (rsmith6559):

C derived languages use = to assign, and == to compare. Pascal derived languages use := for assignment and = for comparison.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
midnightriver46: Is anyone learning korean in here?
30 minutes ago 18 Replies 1 Medal
Gucchi: physics
21 hours ago 17 Replies 0 Medals
Gucchi: physics
23 hours ago 10 Replies 0 Medals
gelphielvr: What's the difference between colonization and imperialism
20 hours ago 2 Replies 0 Medals
gelphielvr: I need tips on how to memorize long formulas does anyone have any
4 hours ago 4 Replies 0 Medals
gelphielvr: how do I find the valance electrons? no further info
4 hours ago 1 Reply 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!