Middle-square method: Difference between revisions

Content deleted Content added
No edit summary
Line 25:
Here, the algorithm is rendered in [[Python 3]].
<syntaxhighlight lang="python">
seed_number = int(input("Please enter a four -digit number:\n[####] "))
number = seed_number
already_seen = set()
Line 36:
print(f"#{counter}: {number}")
 
print(f"We began with {seed_number}, and"
f" have repeated ourselves after {counter} steps"
f" with {number}.")