Middle-square method: Difference between revisions

Content deleted Content added
Undid revision 1291731333 by Laucette (talk)
Undid revision 1291731201 by Laucette (talk)
Line 25:
Here, the algorithm is rendered in [[Python 3|Python 3.12]].
<syntaxhighlight lang="python" line="1">
numberseed_number = int(input("Please enter a four-digit number:\n[####] "))
number = seed_number
already_seen = set()
counter = 0
Line 36 ⟶ 37:
print(f"#{counter}: {number}")
 
print(f"We began with {numberseed_number} and"
f" have repeated ourselves after {counter} steps"
f" with {number}.")