mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Bugfix in Syracuse sequence.
This commit is contained in:
parent
98bebe3117
commit
8c51a96cf9
1 changed files with 3 additions and 3 deletions
|
@ -104,13 +104,13 @@ def syracuse(l=15):
|
|||
while True:
|
||||
yield syracuse_gen(n, l)
|
||||
n += 1
|
||||
|
||||
|
||||
def syracuse_gen(n, l=15):
|
||||
if n == 0:
|
||||
return l
|
||||
if n % 2 == 0:
|
||||
if syracuse_gen(n-1) % 2 == 0:
|
||||
return syracuse_gen(n-1)/2
|
||||
elif n % 2 == 1:
|
||||
elif syracuse_gen(n-1) % 2 == 1:
|
||||
return 3*syracuse_gen(n-1)+1
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue