Sum of primes in odd positions is prime: Difference between revisions
Sum of primes in odd positions is prime (view source)
Revision as of 20:38, 31 January 2023
, 1 year agoJ
(adjusted task description to fit solutions) |
(J) |
||
Line 356:
260 P = T
270 RETURN</syntaxhighlight>
=={{header|J}}==
<syntaxhighlight lang=J> (i,.p,.sum) #~ 1 p: sum=. +/\ p=. p:<:i=. (#~ 2|])i.p:inv 1000
1 2 2
3 5 7
11 31 89
27 103 659
35 149 1181
67 331 5021
91 467 9923
95 499 10909
99 523 11941
119 653 17959
143 823 26879</syntaxhighlight>
=={{header|jq}}==
|