-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEuler_Problem-046.b93
86 lines (76 loc) · 11.8 KB
/
Euler_Problem-046.b93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
v##### ### // Project Euler - Problem 46
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
########################################################################################################################################################################################################
>2 v >0v>vv p09+g09*2:p07-\g07+g09:<
v p+1/g01\%g01:\"O"< $v < 9@pp8# v/4 < >:90g+70g`! |
>"d"2*:10p"2":20p*40p230pv >030p 350p >50g2+:50p::10g%\10g/1+g" "-#^_^>1+:50g-!#v_::10g%\10g/1+g" "-!#^_:50g\-2/:0^.70>0g>:70g`#^_>:|:/4p09/2g09<
vp08*8**::**::8p11p10:" "< _^#`g03g04< ^ > ^>^ >90g2/90p4/^ >$90g:*-#v_v
>"X"30g:10g%\10g/1+p30g>30g+:40g\` #v_$>30g1+:30p:10g%\10g/1+g" "-| $ ^ <
^p+1/g01\%g01:\" ":< ^ < ^ <
[10] width
[20] height
[30] position
[40] size
[50] i
[70] (isquare-test) op
[80] (isquare-test) 2^30 const
[90] (isquare-test) res
idx to array
:10g%\10g/1+ [g|p]
test integer square
>0v>vv p09+g09*2:p07-\g07+g09:<
9 pp8# v/4 < >:90g+70g`! |
:0^ 70>0g>:70g`#^_>:|:/4p09/2g09<
>^ >90g2/90p4/^ >$90g:*-
-------------------------------------------------------------------------------
I really missed my [sieve of erastothenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes). There were really a few problems without primes in a row.
In this problem we go through all primes `i`, search through all smaller primes `j` were `(i-j)/2` is a quadratic number. If you can't find one, this falsifies the theorem.
Also we use the code from problem 46 to calculate the integer square root.