Babbage problem: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
Line 1,059: | Line 1,059: | ||
The smallest number whose square ends in 269696 is 25264 |
The smallest number whose square ends in 269696 is 25264 |
||
</pre> |
</pre> |
||
=={{header|Scala}}== |
|||
<lang scala>//Babbage Problem |
|||
object babbage{ |
|||
def main( args:Array[String] ){ |
|||
var x:Int = 524 //Sqrt of 269696 = 519.something |
|||
while( (x*x) % 1000000 != 269696 ){ |
|||
if( x%10 == 4 ) |
|||
x = x+2 |
|||
else |
|||
x = x+8 |
|||
} |
|||
println("The smallest positive integer whose square ends in 269696 = " + x ) |
|||
} |
|||
} |
|||
</lang> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |