Prime numbers p for which the sum of primes less than or equal to p is prime: Difference between revisions
Prime numbers p for which the sum of primes less than or equal to p is prime (view source)
Revision as of 21:10, 7 July 2021
, 2 years agoAdd Factor
m (→{{header|REXX}}: fixed closing tag for <lang>) |
(Add Factor) |
||
Line 4:
Find primes '''p''' which the sum of primes less or equal to '''p''' is prime, where '''p < 1,000'''.
<br><br>
=={{header|Factor}}==
{{works with|Factor|0.99 2021-06-02}}
<lang factor>USING: assocs assocs.extras kernel math.primes math.statistics
prettyprint ;
1000 primes-upto dup cum-sum zip [ prime? ] filter-values .</lang>
{{out}}
<pre>
{
{ 2 2 }
{ 3 5 }
{ 7 17 }
{ 13 41 }
{ 37 197 }
{ 43 281 }
{ 281 7699 }
{ 311 8893 }
{ 503 22039 }
{ 541 24133 }
{ 557 25237 }
{ 593 28697 }
{ 619 32353 }
{ 673 37561 }
{ 683 38921 }
{ 733 43201 }
{ 743 44683 }
{ 839 55837 }
{ 881 61027 }
{ 929 66463 }
{ 953 70241 }
}
</pre>
=={{header|Go}}==
|