Jump to content

Prime reciprocal sum: Difference between revisions

J
(New draft task and Raku example)
 
(J)
Line 29:
 
 
=={{header|J}}==
 
Given:
 
<syntaxhighlight lang=J>taskfmt=: {{
if. 40<#t=. ":y do.
d=. ":#t
(20{.t),'..',(_20{.t),' (',d,' digits)'
else.
t
end.
}}@></syntaxhighlight>
 
The task and stretch could be:
 
<syntaxhighlight lang=J> taskfmt (, 4 p:1%1-+/@:%)^:(15)i.0
2
3
7
43
1811
654149
27082315109
153694141992520880899
337110658273917297268061074384231117039
84241975970641143191..13803869133407474043 (76 digits)
20300753813848234767..91313959045797597991 (150 digits)
20323705381471272842..21649394434192763213 (297 digits)
12748246592672078196..20708715953110886963 (592 digits)
46749025165138838243..65355869250350888941 (1180 digits)
11390125639471674628..31060548964273180103 (2358 digits)
</syntaxhighlight>
=={{header|Raku}}==
The sixteenth is very slow to emerge. Didn't bother trying for the seventeenth. OEIS only lists the first fourteen values.
6,962

edits

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