Anonymous user
Wolstenholme numbers: Difference between revisions
no edit summary
(→{{header|Ruby}}: Add Ruby) |
imported>Maxima enthusiast No edit summary |
||
Line 544:
14: 23541935187269979100228..81502324742766220468879 (1518 digits)
15: 40306783143871607599250..98658901192511859288941 (1539 digits)
</pre>
=={{header|Maxima}}==
<syntaxhighlight lang="maxima">
wolstenholme(n):=num(apply("+",1/makelist(i^2,i,n)))$
/* Test cases */
makelist(wolstenholme(i),i,20);
/* The previous list is enough to find the first 4 Wolstenholme primes */
sublist(%,primep);
</syntaxhighlight>
{{out}}
<pre>
[1,5,49,205,5269,5369,266681,1077749,9778141,1968329,239437889,240505109,40799043101,40931552621,205234915681,822968714749,238357395880861,238820721143261,86364397717734821,17299975731542641]
[5,266681,40799043101,86364397717734821]
</pre>
|