Steady squares: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 4:
<br>
The 3-digit number 376 in the decimal numbering system is an example of numbers with the special property that its square ends with the same digits: '''376*376 = 141376'''. Let's call a number with this property a steady square. Find steady squares under '''10.000'''
 
=={{header|Python}}==
<lang python>
print("working...")
print("Steady numbers under 10.000 are:")
limit = 10000
 
for n in range(limit):
nstr = str(n)
nlen = len(nstr)
square = str(pow(n,2))
rn = square[-nlen:]
if nstr == rn:
print(str(n) + " " + str(square))
 
print("done...")
</lang>
{{out}}
<pre>
working...
Steady numbers under 10.000 are:
0 0
1 1
5 25
6 36
25 625
76 5776
376 141376
625 390625
9376 87909376
done...
</pre>
 
 
=={{header|Ring}}==
<lang ring>
2,468

edits