cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A002371 Period of decimal expansion of 1/(n-th prime) (0 by convention for the primes 2 and 5).

This page as a plain text file.
%I A002371 M4050 N1680 #119 Jul 21 2025 12:05:29
%S A002371 0,1,0,6,2,6,16,18,22,28,15,3,5,21,46,13,58,60,33,35,8,13,41,44,96,4,
%T A002371 34,53,108,112,42,130,8,46,148,75,78,81,166,43,178,180,95,192,98,99,
%U A002371 30,222,113,228,232,7,30,50,256,262,268,5,69,28,141,146,153,155,312,79,110
%N A002371 Period of decimal expansion of 1/(n-th prime) (0 by convention for the primes 2 and 5).
%C A002371 a(n) is the minimum solution x of modular equation 10^x == 1 (mod p), where p = prime(n). - _Carmine Suriano_, Oct 10 2012
%C A002371 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]
%C A002371 Numbers n such that A071126(n) = A000040(n) - 1. - _Hugo Pfoertner_, Mar 18 2003
%C A002371 Except for n = 1 and 3, a(n) divides A006093(n). - _Robert Israel_, Jul 15 2016
%D A002371 Albert H. Beiler, Recreations in the Theory of Numbers, 2nd ed. New York: Dover, 1966, pages 65, 309. ISBN 0-486-21096-0.
%D A002371 John H. Conway and R. K. Guy, The Book of Numbers, Copernicus Press, 1996, p. 162. ISBN 978-0-387-97993-9.
%D A002371 D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 15.
%D A002371 N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D A002371 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A002371 Alois P. Heinz, <a href="/A002371/b002371.txt">Table of n, a(n) for n = 1..20000</a> (first 1000 terms from T. D. Noe)
%H A002371 C. K. Caldwell, The Prime Glossary, <a href="https://t5k.org/glossary/page.php?sort=PeriodOfAPrime">Period of a prime</a>
%H A002371 Matt Parker and Brady Haran, <a href="https://www.youtube.com/watch?v=DmfxIhmGPP4">The Reciprocals of Primes</a>, Numberphile video (2022).
%H A002371 William Shanks, <a href="https://doi.org/10.1098/rspl.1873.0028">On the number of figures in the period of the reciprocal of every prime number below 20,000</a>, Proc. Royal Soc. London, 22 (1874), 200-210. See also on <a href="https://www.jstor.org/stable/112821">JSTOR</a>.
%H A002371 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DecimalExpansion.html">Decimal Expansion</a>
%H A002371 <a href="/index/1#1overn">Index entries for sequences related to decimal expansion of 1/n</a>
%F A002371 From _Alexander Adamchuk_, Jan 28 2007: (Start)
%F A002371 a(A000720(p)) = p - 1 for primes p in A001913.
%F A002371 a(A060257(n)) = prime(A060257(n)) - 1. (End)
%e A002371 A002371(11) = 15 because the 11th prime is 31, and 1/31 = 0.03225806451612903225806451612903225806452... has period 15. - _Richard F. Lyon_, Mar 29 2022
%p A002371 seq(subs(FAIL=0,numtheory:-order(10, ithprime(n))),n=1..100); # _Robert Israel_, Jul 15 2016
%t A002371 Table[ Length[ RealDigits[1 / Prime[n]] [[1, 1]]], {n, 1, 70}]
%t A002371 Table[If[IntegerQ[#], #, 0] &[MultiplicativeOrder[10, Prime[n]]], {n, 1, 70}] (* _Jan Mangaldan_, Jul 07 2020 *)
%o A002371 (PARI) a(n)=if(n<4,n==2,znorder(Mod(10, prime(n))))
%o A002371 (Python)
%o A002371 from sympy import prime, n_order
%o A002371 def A002371(n): return 0 if n == 1 or n == 3 else n_order(10,prime(n)) # _Chai Wah Wu_, Feb 07 2022
%Y A002371 See A048595 for another version. Cf. A006883, A007732, A051626, A071126, A000040, A002275, A097443.
%Y A002371 Cf. A001913 (full repetend primes), A060257 (1/prime(n) has period prime(n) - 1).
%Y A002371 In other bases: A014664, A062117, A211241, A211242, A211243, A211244, A211245, A002371.
%K A002371 nonn,nice,easy,base
%O A002371 1,4
%A A002371 _N. J. A. Sloane_
%E A002371 More terms from Arlin Anderson (starship1(AT)gmail.com)
%E A002371 Edited by _Charles R Greathouse IV_, Mar 24 2010