Jump to content

Prime conspiracy: Difference between revisions

Added Easylang
(→‎{{header|PARI/GP}}: format the pari/gp code)
(Added Easylang)
Line 755:
9 -> 7 count: 58130 frequency: 5.81%
9 -> 9 count: 42843 frequency: 4.28%</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight>
fastfunc isprim num .
# test only odd numbers
i = 3
while i <= sqrt num
if num mod i = 0
return 0
.
i += 2
.
return 1
.
func 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
print i & " -> " & j & ": " & d[i][j] & " = " & d[i][j] / 10000 & "%"
.
.
.
</syntaxhighlight>
 
=={{header|EchoLisp}}==
2,063

edits

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