Wolstenholme numbers: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: oops, output issue) |
Drkameleon (talk | contribs) (added Arturo) |
||
Line 84: | Line 84: | ||
... of the above, the following are prime: 5 266681 40799043101 86364397717734821 |
... of the above, the following are prime: 5 266681 40799043101 86364397717734821 |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<syntaxhighlight lang="arturo">wolstenholme: function [n][ |
|||
numerator fold 1..n [s k] -> s + to :rational @[1 k*k] |
|||
] |
|||
print "First 20 Wolstenholme numbers:" |
|||
loop 1..20 => [print wolstenholme &] |
|||
print "\nFirst 4 Wolstenholme primes:" |
|||
select.first:4 1..∞ => |
|||
[prime? wolstenholme &] | loop => [print wolstenholme &]</syntaxhighlight> |
|||
{{out}} |
|||
<pre>First 20 Wolstenholme numbers: |
|||
1 |
|||
5 |
|||
49 |
|||
205 |
|||
5269 |
|||
5369 |
|||
266681 |
|||
1077749 |
|||
9778141 |
|||
1968329 |
|||
239437889 |
|||
240505109 |
|||
40799043101 |
|||
40931552621 |
|||
205234915681 |
|||
822968714749 |
|||
238357395880861 |
|||
238820721143261 |
|||
86364397717734821 |
|||
17299975731542641 |
|||
First 4 Wolstenholme primes: |
|||
5 |
|||
266681 |
|||
40799043101 |
|||
86364397717734821</pre> |
|||
=={{header|C}}== |
=={{header|C}}== |