Wolstenholme numbers: Difference between revisions
Content added Content deleted
(Created Nim solution.) |
(add RPL) |
||
Line 902: | Line 902: | ||
14th: 23541935187269979100..02324742766220468879 (digits: 1518) |
14th: 23541935187269979100..02324742766220468879 (digits: 1518) |
||
15th: 40306783143871607599..58901192511859288941 (digits: 1539)</pre> |
15th: 40306783143871607599..58901192511859288941 (digits: 1539)</pre> |
||
=={{header|RPL}}== |
|||
{{works with|HP|49g}} |
|||
Wolstenholme numbers displayed as negative are prime. |
|||
≪ |
|||
SQ SWAP ARRY→ DROP |
|||
SWAP 3 PICK * OVER + |
|||
UNROT * DUP2 GCD |
|||
UNROT { 2 } →ARRY |
|||
SWAP / |
|||
≫ '<span style="color:blue">NEXTHARM</span>' STO <span style="color:grey">''( [ a b ] n → [ a' b' ] )'' where a'/b' = a/b + 1/n²</span> |
|||
≪ { } [ 0 1 ] |
|||
1 20 '''FOR''' n |
|||
n <span style="color:blue">NEXTHARM</span> |
|||
SWAP OVER 1 GET |
|||
'''IF''' DUP ISPRIME? '''THEN''' NEG '''END''' |
|||
+ SWAP |
|||
'''NEXT''' DROP |
|||
≫ '<span style="color:blue">TASK</span>' STO |
|||
{{out}} |
|||
<pre> |
|||
1: {1 -5 49 205 5269 5369 -266681 1077749 9778141 1968329 239437889 240505109 -40799043101 40931552621 205234915681 822968714749 238357395880861 238820721143261 -86364397717734821 17299975731542641} |
|||
</pre> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |