I am trying to do an if block in sage. For example, I have code: for n in range(7): if gcd(n,3)==3: n=n/3; n=n+1; print(n)

This "should" only add one when n is divisible by 3, but seems to do this all the time. Any ideas?

1 | initial version |

I am trying to do an if block in sage. For example, I have code: for n in range(7): if gcd(n,3)==3: n=n/3; n=n+1; print(n)

This "should" only add one when n is divisible by 3, but seems to do this all the time. Any ideas?

2 | No.2 Revision |

I am trying to do an if block in sage. For example, I have ~~code:
~~code:

```
for n in range(7):
if gcd(n,3)==3:
n=n/3;
n=n+1;
```~~print(n)~~print(n)

This "should" only add one when n is divisible by 3, but seems to do this all the time. Any ideas?

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.