34 lines
557 B
Text
34 lines
557 B
Text
fastfunc isprim num .
|
|
# test only odd numbers
|
|
i = 3
|
|
while i <= sqrt num
|
|
if num mod i = 0 : return 0
|
|
i += 2
|
|
.
|
|
return 1
|
|
.
|
|
fastfunc nextprim num .
|
|
repeat
|
|
num += 2
|
|
until isprim num = 1
|
|
.
|
|
return num
|
|
.
|
|
len d[][] 9
|
|
for i to 9 : len d[i][] 9
|
|
d[2][3] = 1
|
|
p = 3
|
|
for i to 1000000
|
|
pp = p
|
|
p = nextprim p
|
|
d[pp mod 10][p mod 10] += 1
|
|
.
|
|
for i to 9 : for j to 9
|
|
if d[i][j] > 0
|
|
write i & " -> " & j & ": "
|
|
numfmt 5 0
|
|
write d[i][j] & " = "
|
|
numfmt 0 2
|
|
print d[i][j] / 10000 & "%"
|
|
.
|
|
.
|