RosettaCodeData/Task/Long-primes/00-TASK.txt
2023-07-01 13:44:08 -04:00

50 lines
2.4 KiB
Text

A   '''long prime'''   (as defined here)   is a prime number whose reciprocal   (in decimal)   has
a   ''period length''   of one less than the prime number.
'''Long primes'''   are also known as:
:::*   base ten cyclic numbers
:::*   full reptend primes
:::*   golden primes
:::*   long period primes
:::*   maximal period primes
:::*   proper primes
Another definition:   primes   '''p'''   such that the decimal expansion of   '''1/p'''   has period   '''p-1''',   which is the greatest period possible for any integer.
;Example:
'''7'''   is the first long prime,   the reciprocal of seven
is &nbsp; <big><sup>'''1'''</sup>'''/'''<sub>'''7'''</sub></big>, &nbsp; which
is equal to the repeating decimal fraction &nbsp; '''0.142857<u>142857</u>···
The <u>length</u> of the &nbsp; ''repeating'' &nbsp; part of the decimal fraction
is six, &nbsp; (the underlined part) &nbsp; which is one less
than the (decimal) prime number &nbsp; '''7'''.
<br>Thus &nbsp; '''7''' &nbsp; is a long prime.
There are other (more) general definitions of a &nbsp; '''long prime''' &nbsp; which
include wording/verbiage for bases other than ten.
;Task:
:* &nbsp; Show all long primes up to &nbsp; '''500''' &nbsp; (preferably on one line).
:* &nbsp; Show the &nbsp; ''number'' &nbsp; of long primes up to &nbsp; &nbsp; &nbsp;&nbsp; ''' 500'''
:* &nbsp; Show the &nbsp; ''number'' &nbsp; of long primes up to &nbsp; &nbsp; ''' 1,000'''
:* &nbsp; Show the &nbsp; ''number'' &nbsp; of long primes up to &nbsp; &nbsp; ''' 2,000'''
:* &nbsp; Show the &nbsp; ''number'' &nbsp; of long primes up to &nbsp; &nbsp; ''' 4,000'''
:* &nbsp; Show the &nbsp; ''number'' &nbsp; of long primes up to &nbsp; &nbsp; ''' 8,000'''
:* &nbsp; Show the &nbsp; ''number'' &nbsp; of long primes up to &nbsp; '''16,000'''
:* &nbsp; Show the &nbsp; ''number'' &nbsp; of long primes up to &nbsp; '''32,000'''
:* &nbsp; Show the &nbsp; ''number'' &nbsp; of long primes up to &nbsp; '''64,000''' &nbsp; (optional)
:* &nbsp; Show all output here.
;;;Also see:
:* &nbsp; [[wp:Full_reptend_prime|Wikipedia: full reptend prime]]
:* &nbsp; [http://mathworld.wolfram.com/FullReptendPrime.html MathWorld: full reptend prime]
:* &nbsp; [[oeis:A001913|OEIS: A001913]]
<br><br>