Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Babbage-problem/APL/babbage-problem-1.apl
Normal file
10
Task/Babbage-problem/APL/babbage-problem-1.apl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
⍝ We know that 99,736 is a valid answer, so we only need to test the positive integers from 1 up to there:
|
||||
N←⍳99736
|
||||
⍝ The SQUARE OF omega is omega times omega:
|
||||
SQUAREOF←{⍵×⍵}
|
||||
⍝ To say that alpha ENDS IN the six-digit number omega means that alpha divided by 1,000,000 leaves remainder omega:
|
||||
ENDSIN←{(1000000|⍺)=⍵}
|
||||
⍝ The SMALLEST number WHERE some condition is met is found by taking the first number from a list of attempts, after rearranging the list so that numbers satisfying the condition come before those that fail to satisfy it:
|
||||
SMALLESTWHERE←{1↑⍒⍵}
|
||||
⍝ We can now ask the computer for the answer:
|
||||
SMALLESTWHERE (SQUAREOF N) ENDSIN 269696
|
||||
4
Task/Babbage-problem/APL/babbage-problem-2.apl
Normal file
4
Task/Babbage-problem/APL/babbage-problem-2.apl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
⍝ s = 520 + 2 ... + 2 ⍣ <= power
|
||||
⍝ s × s = n × 1000000 + 269696 | <= remainder
|
||||
|
||||
2+⍣{269696=1000000|⍺×⍺}520
|
||||
Loading…
Add table
Add a link
Reference in a new issue