OFFSET
1,4
COMMENTS
a(n) is the minimum solution x of modular equation 10^x == 1 (mod p), where p = prime(n). - Carmine Suriano, Oct 10 2012
a(n) = smallest m such that 111...11 (m 1's) is divisible by the n-th prime, or 0 if no such m exists (with the exception that a(2) = 3 instead of 1). E.g., the 5th prime, 11, divides 11, so a(5) = 2. - N. J. A. Sloane, Oct 03 2013 [Comment corrected by Derek Orr, Jun 14 2014]
Except for n = 1 and 3, a(n) divides A006093(n). - Robert Israel, Jul 15 2016
REFERENCES
Albert H. Beiler, Recreations in the Theory of Numbers, 2nd ed. New York: Dover, 1966, pages 65, 309. ISBN 0-486-21096-0.
John H. Conway and R. K. Guy, The Book of Numbers, Copernicus Press, p. 162.
D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 15.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000 (first 1000 terms from T. D. Noe)
C. K. Caldwell, The Prime Glossary, Period of a prime
Matt Parker and Brady Haran, The Reciprocals of Primes, Numberphile video (2022).
William Shanks, On the number of figures in the period of the reciprocal of every prime number below 20 000, Proc. Royal Soc. London, 22 (1874), 200-210. See also on JSTOR.
Eric Weisstein's World of Mathematics, Decimal Expansion
FORMULA
From Alexander Adamchuk, Jan 28 2007: (Start)
EXAMPLE
A002371(11) = 15 because the 11th prime is 31, and 1/31 = 0.03225806451612903225806451612903225806452... has period 15. - Richard F. Lyon, Mar 29 2022
MAPLE
seq(subs(FAIL=0, numtheory:-order(10, ithprime(n))), n=1..100); # Robert Israel, Jul 15 2016
MATHEMATICA
Table[ Length[ RealDigits[1 / Prime[n]] [[1, 1]]], {n, 1, 70}]
Table[If[IntegerQ[#], #, 0] &[MultiplicativeOrder[10, Prime[n]]], {n, 1, 70}] (* Jan Mangaldan, Jul 07 2020 *)
PROG
(PARI) a(n)=if(n<4, n==2, znorder(Mod(10, prime(n))))
(Python)
from sympy import prime, n_order
def A002371(n): return 0 if n == 1 or n == 3 else n_order(10, prime(n)) # Chai Wah Wu, Feb 07 2022
CROSSREFS
KEYWORD
nonn,nice,easy,base
AUTHOR
EXTENSIONS
More terms from Arlin Anderson (starship1(AT)gmail.com)
Edited by Charles R Greathouse IV, Mar 24 2010
STATUS
approved