22 lines
937 B
Text
22 lines
937 B
Text
;Definition
|
|
A ''Wagstaff prime'' is a prime number of the form ''(2^p + 1)/3'' where the exponent ''p'' is an odd prime.
|
|
|
|
;Example
|
|
(2^5 + 1)/3 = 11 is a Wagstaff prime because both 5 and 11 are primes.
|
|
|
|
;Task
|
|
Find and show here the first ''10'' Wagstaff primes and their corresponding exponents ''p''.
|
|
|
|
;Stretch (requires arbitrary precision integers)
|
|
Find and show here the exponents ''p'' corresponding to the next ''14'' Wagstaff primes (not the primes themselves) and any more that you have the patience for.
|
|
|
|
When testing for primality, you may use a method which determines that a large number is probably prime with reasonable certainty.
|
|
|
|
;Note
|
|
It can be shown (see talk page) that ''(2^p + 1)/3'' is always integral if ''p'' is odd. So there's no need to check for that prior to checking for primality.
|
|
|
|
;References
|
|
|
|
* [[wp:Wagstaff prime|Wikipedia - Wagstaff prime]]
|
|
* [[oeis:A000979|OEIS:A000979 - Wagstaff primes]]
|
|
<br><br>
|