Jump to content

Babbage problem: Difference between revisions

J draft
(J draft)
Line 106:
{{out}}
<pre>25264</pre>
 
=={header|J}==
 
The key to understandability is a mix of hopefully adequate notation and some level of verifiability.
 
So let's break the implementation into some named pieces and present enough detail that a mathematician can verify that the result is both consistent and reasonable:
 
<lang J> square=: ^&2
modulo1e6=: 1000000&|
trythese=: i. 1000000 NB. first million nonnegative integers
which 269696=modulo1e6 square trythese NB. right to left <-
25264 99736 150264 224736 275264 349736 400264 474736 525264 599736 650264 724736 775264 849736 900264 974736</lang>
 
The smallest of these values is 25264,
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.