10001st prime
2014-09-11
Problem 007: 10001st prime
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
Solution:
v
# ... #
. . . .
. . .
. . . .
# ... #
v <
>"d"55+*:10p3"2"*:20p*00p230p" ":01p11p10g5:+*1+50pv > 030p 040p>30g1+:30p:10g%\10g/1+g"X"- |
v < _^#`g03g00 <|p+1/g01\%g01:g03"0"-p04:+1g04g05<
> "X" 30g:10g%\10g/1+p30g >30g+ : 00g\` #v_$>30g1+:30p:10g%\10g/1+g" "- |>30g.@
^p+1/g01\%g01:\" ":< ^ <
# ... #
. . . .
. . .
. . . .
# ... #
v <
>"d"55+*:10p3"2"*:20p*00p230p" ":01p11p10g5:+*1+50pv > 030p 040p>30g1+:30p:10g%\10g/1+g"X"- |
v < _^#`g03g00 <|p+1/g01\%g01:g03"0"-p04:+1g04g05<
> "X" 30g:10g%\10g/1+p30g >30g+ : 00g\` #v_$>30g1+:30p:10g%\10g/1+g" "- |>30g.@
^p+1/g01\%g01:\" ":< ^ <
Explanation:
Finally a opportunity to use my favorite algorithm: The sieve of Eratosthenes.
Interpreter steps: | 21 915 385 |
Execution time (BefunExec): | 7.63s (2.87 MHz) |
Program size: | 1000 x 156 |
Solution: | 104743 |
Solved at: | 2014-09-11 |