1 | initial version |
Maybe you get confused by the fact that gcd(0,3) equals 3. If I print each step, it works as expected.
sage: for n in range(9):
... print "n=",n
... if gcd(n,3)==3:
... print "?"
... n=n/3;
... n=n+1;
... print "*",n
n= 0
?
* 1
n= 1
* 1
n= 2
* 2
n= 3
?
* 2
n= 4
* 4
n= 5
* 5
n= 6
?
* 3
n= 7
* 7
n= 8
* 8
2 | No.2 Revision |
Maybe you get confused by the fact that gcd(0,3) equals 3. If I print each step, it works as expected.
sage:
for n in