Middle-square method: Difference between revisions

Content deleted Content added
Adding local short description: "Pseudorandom number generator", overriding Wikidata description "pseudorandom number generator"
Tags: Reverted Visual edit
Line 25:
Here, the algorithm is rendered in [[Python 3|Python 3.12]].
<syntaxhighlight lang="python" line="1">
seed_numbernumber = int(input("Please enter a four-digit number:\n[####] "))
number = seed_number
already_seen = set()
counter = 0
Line 37 ⟶ 36:
print(f"#{counter}: {number}")
 
print(f"We began with {seed_numbernumber} and"
f" have repeated ourselves after {counter} steps"
f" with {number}.")