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.

Showing 1-10 of 64 results. Next

A048595 Alternative start to A002371, which is the main entry for this sequence.

Original entry on oeis.org

1, 1, 1, 6, 2, 6, 16, 18, 22, 28, 15, 3, 5, 21, 46, 13, 58, 60, 33, 35, 8, 13, 41, 44, 96, 4, 34, 53, 108, 112, 42, 130, 8, 46, 148, 75, 78, 81, 166, 43, 178, 180, 95, 192, 98, 99, 30, 222, 113, 228, 232, 7, 30, 50, 256, 262, 268, 5, 69, 28, 141, 146, 153, 155, 312, 79, 110
Offset: 1

Views

Author

Keywords

Comments

This sequence also gives the number of digits of the periodic part of the decimal expansion of n/(n-th prime). The periodic part of 1/(n-th prime) (cf. A060283) is in general different from the periodic part of n/(n-th prime) (cf. A060251), but their lengths are equal. - Klaus Brockhaus, Apr 01 2001

Crossrefs

A072860 Highest power of 3 dividing the period length of 1/prime(n) = A002371(n).

Original entry on oeis.org

0, 1, 0, 3, 1, 3, 1, 9, 1, 1, 3, 3, 1, 3, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 3, 1, 1, 1, 27, 1, 3, 1, 1, 1, 1, 3, 3, 81, 1, 1, 1, 9, 1, 3, 1, 9, 3, 3, 1, 3, 1, 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 9, 1, 3, 1, 1, 3, 1, 1, 1, 1, 3, 3, 27, 1, 1, 9, 1, 3, 1, 1, 1, 27, 3, 1, 1, 1, 1, 1, 1, 1, 243, 1, 3, 1, 1, 1, 9, 27
Offset: 1

Views

Author

Benoit Cloitre, Jul 26 2002

Keywords

Crossrefs

Cf. A002371.

Programs

  • PARI
    for n>3 ? a(n)=if(n<4,n==2,znorder(Mod(10, prime(n)))) ? for(n=4,150,print1(gcd(a(n),3^100),","))

A014664 Order of 2 modulo the n-th prime.

Original entry on oeis.org

2, 4, 3, 10, 12, 8, 18, 11, 28, 5, 36, 20, 14, 23, 52, 58, 60, 66, 35, 9, 39, 82, 11, 48, 100, 51, 106, 36, 28, 7, 130, 68, 138, 148, 15, 52, 162, 83, 172, 178, 180, 95, 96, 196, 99, 210, 37, 226, 76, 29, 119, 24, 50, 16, 131, 268, 135, 92, 70, 94, 292, 102, 155, 156, 316
Offset: 2

Views

Author

Keywords

Comments

In other words, a(n), n >= 2, is the least k such that prime(n) divides 2^k-1.
Concerning the complexity of computing this sequence, see for example Bach and Shallit, p. 115, exercise 8.
Also A002326((p_n-1)/2). Conjecture: If p_n is not a Wieferich prime (1093, 3511, ...) then A002326(((p_n)^k-1)/2) = a(n)*(p_n)^(k-1). - Vladimir Shevelev, May 26 2008
If for distinct i,j,...,k we have a(i)=a(j)=...=a(k) then the number N = p_i*p_j*...*p_k is in A001262 and moreover A137576((N-1)/2) = N. For example, a(16)=a(37)=a(255)=52. Therefore we could take N = p_16*p_37*p_255 = 53*157*1613 = 13421773. - Vladimir Shevelev, Jun 14 2008
Also degree of the irreducible polynomial factors for the polynomial (x^p+1)/(x+1) over GF(2), where p is the n-th prime. - V. Raman, Oct 04 2012
Is this the same as the smallest k > 1 not already in the sequence such that p = prime(n) is a factor of 2^k-1 (A270600)? If the answer is yes, is the sequence a permutation of the positive integers > 1? - Felix Fröhlich, Feb 21 2016. Answer: No, it is easy to prove that 6 is missing and obviously 11 appears twice. - N. J. A. Sloane, Feb 21 2016
pi(A112927(m)) is the index at which a given number m first appears in this sequence. - M. F. Hasler, Feb 21 2016

Examples

			2^2 == 1 (mod 3) and so a(2) = 2;
2^4 == 1 (mod 5) and so a(3) = 4;
2^3 == 1 (mod 7) and so a(4) = 3;
2^10 == 1 (mod 11) and so a(5) = 10; etc.
[Conway & Guy, p. 166]: Referring to the work of Euler, 1/13 in base 2 = 0.000100111011...; (cycle length of 12). - _Gary W. Adamson_, Aug 22 2009
		

References

  • E. Bach and Jeffrey Shallit, Algorithmic Number Theory, I.
  • Albert H. Beiler, "Recreations in the Theory of Numbers", Dover, 1966; Table 48, page 98, "Exponents to Which a Belongs, MOD p and MOD p^n.
  • John H. Conway and Richard Guy, "The Book of Numbers", Springer-Verlag, 1996; p. 166: "How does the Cycle Length Change with the Base?". [From Gary W. Adamson, Aug 22 2009]
  • S. K. Sehgal, Group rings, pp. 455-541 in Handbook of Algebra, Vol. 3, Elsevier, 2003; see p. 493.

Crossrefs

Cf. A002326 (order of 2 mod 2n+1), A001122 (full reptend primes in base 2), A065941, A112927.

Programs

  • GAP
    P:=Filtered([1..350],IsPrime);; a:=List([2..Length(P)],n->OrderMod(2,P[n]));; Print(a); # Muniru A Asiru, Jan 29 2019
    
  • Maple
    with(numtheory): [ seq(order(2,ithprime(n)), n=2..60) ];
  • Mathematica
    Reap[Do[p=Prime[i];Do[If[PowerMod[2,k,p]==1,Print[{i,k}];Sow[{i,k}];Goto[ni]],{k,1,10^6}];Label[ni],{i,2,5001}]][[2,1]] (* Zak Seidov, Jan 26 2009 *)
    Table[MultiplicativeOrder[2, Prime[n]], {n, 2, 70}] (* Jean-François Alcover, Dec 10 2015 *)
  • PARI
    a(n)=if(n<0,0,k=1;while((2^k-1)%prime(n)>0,k++);k)
    
  • PARI
    A014664(n)=znorder(Mod(2, prime(n))) \\ Nick Hobson, Jan 08 2007, edited by M. F. Hasler, Feb 21 2016
    
  • PARI
    forprime(p=3, 800, print(factormod((x^p+1)/(x+1), 2, 1)[1, 1])) \\ V. Raman, Oct 04 2012
    
  • Python
    from sympy import n_order, prime
    def A014664(n): return n_order(2,prime(n)) # Chai Wah Wu, Nov 09 2023

Formula

a(n) = (A000040(n)-1)/A001917(n); a(A072190(n)) = A001122(n) - 1. - Benoit Cloitre, Jun 06 2004

Extensions

More terms from Benoit Cloitre, Apr 11 2003

A001913 Full reptend primes: primes with primitive root 10.

Original entry on oeis.org

7, 17, 19, 23, 29, 47, 59, 61, 97, 109, 113, 131, 149, 167, 179, 181, 193, 223, 229, 233, 257, 263, 269, 313, 337, 367, 379, 383, 389, 419, 433, 461, 487, 491, 499, 503, 509, 541, 571, 577, 593, 619, 647, 659, 701, 709, 727, 743, 811, 821, 823, 857, 863, 887, 937, 941, 953, 971, 977, 983
Offset: 1

Views

Author

Keywords

Comments

Primes p such that the decimal expansion of 1/p has period p-1, which is the greatest period possible for any integer.
Primes p such that the corresponding entry in A002371 is p-1.
Pieter Moree writes (Oct 20 2004): Assuming the Generalized Riemann Hypothesis it can be shown that the density of primes p such that a prescribed integer g has order (p-1)/t, with t fixed exists and, moreover, it can be computed. This density will be a rational number times the so-called Artin constant. For 2 and 10 the density of primitive roots is A, the Artin constant itself.
R. K. Guy writes (Oct 20 2004): MR 2004j:11141 speaks of the unearthing by Lenstra & Stevenhagen of correspondence concerning the density of this sequence between the Lehmers & Artin.
Also called long period primes, long primes or maximal period primes.
The base-10 cyclic numbers A180340, (b^(p-1) - 1) / p, with b = 10, are obtained from the full reptend primes p. - Daniel Forgues, Dec 17 2012
The number of terms < 10^n: A086018(n). - Robert G. Wilson v, Aug 18 2014

Examples

			7 is in the sequence because 1/7 = 0.142857142857... and the period = 7-1 = 6.
		

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 864.
  • Albert H. Beiler, Recreations in the Theory of Numbers, 2nd ed. New York: Dover, 1966, pages 65, 309.
  • John H. Conway and R. K. Guy, The Book of Numbers, Copernicus Press, p. 161.
  • C. F. Gauss, Disquisitiones Arithmeticae, Yale, 1965; see p. 380.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 115.
  • M. Kraitchik, Recherches sur la Théorie des Nombres. Gauthiers-Villars, Paris, Vol. 1, 1924, Vol. 2, 1929, see Vol. 1, p. 61.
  • H. Rademacher and O. Toeplitz, Von Zahlen und Figuren (Springer 1930, reprinted 1968), Ch. 19, 'Die periodischen Dezimalbrüche'.
  • 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).

Crossrefs

Apart from initial term, identical to A006883.
Other definitions of cyclic numbers: A003277, A001914, A180340.

Programs

  • Maple
    A001913 := proc(n) local st, period:
    st := ithprime(n):
    period := numtheory[order](10,st):
    if (st-1 = period) then
       RETURN(st):
    fi: end:  seq(A001913(n), n=1..200); # Jani Melik, Feb 25 2011
  • Mathematica
    pr=10; Select[Prime[Range[200]], MultiplicativeOrder[pr, # ] == #-1 &]
    (* Second program: *)
    Join[{7},Select[Prime[Range[300]],PrimitiveRoot[#,10]==10&]] (* Harvey P. Dale, Feb 01 2018 *)
  • PARI
    forprime(p=7,1e3,if(znorder(Mod(10,p))+1==p,print1(p", "))) \\ Charles R Greathouse IV, Feb 27 2011
    
  • PARI
    is(n)=Mod(10,n)^(n\2)==-1 && isprime(n) && znorder(Mod(10,n))+1==n \\ Charles R Greathouse IV, Oct 24 2013
    
  • Python
    from itertools import count, islice
    from sympy import nextprime, n_order
    def A001913_gen(startvalue=1): # generator of terms >= startvalue
        p = max(startvalue-1,1)
        while (p:=nextprime(p)):
            if p!=2 and p!=5 and n_order(10,p)==p-1:
                yield p
    A001913_list = list(islice(A001913_gen(),20)) # Chai Wah Wu, Mar 03 2025

A051626 Period of decimal representation of 1/n, or 0 if 1/n terminates.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 6, 0, 1, 0, 2, 1, 6, 6, 1, 0, 16, 1, 18, 0, 6, 2, 22, 1, 0, 6, 3, 6, 28, 1, 15, 0, 2, 16, 6, 1, 3, 18, 6, 0, 5, 6, 21, 2, 1, 22, 46, 1, 42, 0, 16, 6, 13, 3, 2, 6, 18, 28, 58, 1, 60, 15, 6, 0, 6, 2, 33, 16, 22, 6, 35, 1, 8, 3, 1, 18, 6, 6, 13, 0, 9, 5, 41, 6, 16, 21, 28, 2, 44, 1
Offset: 1

Views

Author

Keywords

Comments

Essentially same as A007732.
For any prime number p: if a(p) > 0, a(p) divides p-1. - David Spitzer, Jan 09 2017

Examples

			From _M. F. Hasler_, Dec 14 2015: (Start)
a(1) = a(2) = 0 because 1/1 = 1 and 1/2 = 0.5 have a finite decimal expansion.
a(3) = a(6) = a(9) = a(12) = 1 because 1/3 = 0.{3}*, 1/6 = 0.1{6}*, 1/9 = 0.{1}*, 1/12 = 0.08{3}* where the sequence of digits {...}* which repeats indefinitely is of length 1.
a(7) = 6 because 1/7 = 0.{142857}* with a period of 6.
a(17) = 16 because 1/17 = 0.{0588235294117647}* with a period of 16.
a(19) = 18 because 1/19 = 0.{052631578947368421}* with a period of 18. (End)
		

Crossrefs

Essentially same as A007732. Cf. A002371, A048595, A006883, A036275, A114205, A114206, A001913.

Programs

  • Maple
    A051626 := proc(n) local lpow,mpow ;
        if isA003592(n) then
           RETURN(0) ;
        else
           lpow:=1 ;
           while true do
              for mpow from lpow-1 to 0 by -1 do
                  if (10^lpow-10^mpow) mod n =0 then
                     RETURN(lpow-mpow) ;
                  fi ;
              od ;
              lpow := lpow+1 ;
           od ;
        fi ;
    end: # R. J. Mathar, Oct 19 2006
  • Mathematica
    r[x_]:=RealDigits[1/x]; w[x_]:=First[r[x]]; f[x_]:=First[w[x]]; l[x_]:=Last[w[x]]; z[x_]:=Last[r[x]];
    d[x_] := Which[IntegerQ[l[x]], 0, IntegerQ[f[x]]==False, Length[f[x]], True, Length[l[x]]]; Table[d[i], {i,1,90}] (* Hans Havermann, Oct 19 2006 *)
    fd[n_] := Block[{q},q = Last[First[RealDigits[1/n]]];If[IntegerQ[q], q = {}]; Length[q]];Table[fd[n], {n, 100}] (* Ray Chandler, Dec 06 2006 *)
    Table[Length[RealDigits[1/n][[1,-1]]],{n,90}] (* Harvey P. Dale, Jul 03 2011 *)
    a[n_] := If[ PowerMod[10, n, n] == 0, 0, MultiplicativeOrder[10, n/2^IntegerExponent[n, 2]/5^IntegerExponent[n, 5]]]; Array[a, 90] (* myself in A003592 and T. D. Noe in A007732 *) (* Robert G. Wilson v, Feb 20 2025 *)
  • PARI
    A051626(n)=if(1M. F. Hasler, Dec 14 2015
    
  • Python
    def A051626(n):
        if isA003592(n):
            return 0
        else:
            lpow=1
            while True:
                for mpow in range(lpow-1,-1,-1):
                    if (10**lpow-10**mpow) % n == 0:
                        return lpow-mpow
                lpow += 1 # Kenneth Myers, May 06 2016
    
  • Python
    from sympy import multiplicity, n_order
    def A051626(n): return 0 if (m:=(n>>(~n & n-1).bit_length())//5**multiplicity(5,n)) == 1 else n_order(10,m) # Chai Wah Wu, Aug 11 2022

Formula

a(n)=A132726(n,1); a(n)=a(A132740(n)); a(A132741(n))=a(A003592(n))=0. - Reinhard Zumkeller, Aug 27 2007

Extensions

More terms from James Sellers

A020806 Decimal expansion of 1/7.

Original entry on oeis.org

1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2, 8, 5, 7, 1, 4, 2
Offset: 0

Views

Author

Keywords

Comments

142857 and 999999 = 7*142857 are first and last Kaprekar numbers with six digits. Note a(n) + a(n+3) = 9. (142857^2 = 20408122449; 20408 + 122449 = 142857.) a(n)^2 = 1, 16, 4, 64, 25, 49, ... - Paul Curtz, Aug 24 2009
The constant 19 + 1/7 = 19.142857... is the Kirchhoff index of the Möbius ladder graph on v=8 vertices. The Laplacian matrix has the eigenvalues 4 (one time), 4-sqrt(2) (2 times), 4+sqrt(2) (2 times), 2 (2 times) and 0 (one time). Then the Kirchhoff index is v times the sum over the inverse, nonzero eigenvalues. - R. J. Mathar, Feb 13 2011
Decimal expansion of -99*(zeta(-5) + zeta(-9)) - 1. - Arkadiusz Wesolowski, Sep 15 2013
Also, decimal expansion of Sum_{i>0} 1/8^i. - Bruno Berselli, Jan 03 2014
The points whose coordinates are overlapping pairs of digits of this sequence, (1, 4), (4, 2), (2, 8), (8, 5), (5, 7) and (7, 1), all lie on one ellipse, with equation 19*x^2 + 36*x*y + 41*y^2 - 333*x - 531*y = -1638. Overlapping pairs of pairs of digits, (14, 28), (42, 85), (28, 57), (85, 71), (57, 14), (71, 42), also yield 6 points on one ellipse, with equation -165104*x^2 + 160804*x*y + 8385498*x - 41651*y^2 - 3836349*y = 7999600. (See book by Wells and MathWorld link.) - M. F. Hasler, Oct 25 2017

Examples

			0.142857142857142857...
		

References

  • H. Rademacher and O. Toeplitz, Von Zahlen und Figuren (Springer 1930, reprinted 1968), ch. 19, 'Die periodischen Dezimalbrüche'.
  • D. Wells, The Penguin Dictionary of Curious and Interesting Numbers. Middlesex, England: Penguin Books, 1986.

Crossrefs

Programs

  • Magma
    I:=[1,4,2,8]; [n le 4 select I[n] else Self(n-1)-Self(n-3)+Self(n-4): n in [1..100]]; // Vincenzo Librandi, Mar 27 2015
    
  • Maple
    Digits:=100: evalf(1/7); # Wesley Ivan Hurt, Jun 28 2016
  • Mathematica
    CoefficientList[Series[(1 + 3 x - 2 x^2 + 7 x^3) / ((1 - x) (1 + x) (1 - x + x^2)), {x, 0, 100}], x] (* Vincenzo Librandi, Mar 27 2015 *)
    realDigitsRecip[7] (* The realDigitsRecip program is at A021200 *) (* Harvey P. Dale, Sep 18 2024 *)
  • PARI
    1/7. \\ Charles R Greathouse IV, Sep 24 2015
    
  • PARI
    digits(10^99\7) \\ M. F. Hasler, Oct 25 2017

Formula

From Reinhard Zumkeller, Oct 06 2008: (Start)
A028416(1)=7; A002371(A049084(7)) = A002371(4) = 6.
a(n+6) = a(n), a(n+6/2) = 9 - a(n). (End)
From Colin Barker, Aug 14 2012: (Start)
a(n) = a(n-1) - a(n-3) + a(n-4) for n>3.
G.f.: (1+3*x-2*x^2+7*x^3) / ((1-x)*(1+x)*(1-x+x^2)). (End)
a(n) = A068028(n+2). - Zak Seidov, Mar 26 2015
a(n) = (27 - 11*cos(n*Pi) - 10*cos(n*Pi/3) - 6*sqrt(3)*sin(n*Pi/3))/6. - Wesley Ivan Hurt, Jun 28 2016
E.g.f.: (8*cosh(x) - exp(x/2)*(5*cos(sqrt(3)*x/2) + 3*sqrt(3)*sin(sqrt(3)*x/2)) + 19*sinh(x))/3. - Stefano Spezia, Dec 07 2024

A062117 Order of 3 mod n-th prime.

Original entry on oeis.org

1, 0, 4, 6, 5, 3, 16, 18, 11, 28, 30, 18, 8, 42, 23, 52, 29, 10, 22, 35, 12, 78, 41, 88, 48, 100, 34, 53, 27, 112, 126, 65, 136, 138, 148, 50, 78, 162, 83, 172, 89, 45, 95, 16, 196, 198, 210, 222, 113, 57, 232, 119, 120, 125, 256, 131, 268, 30, 69, 280, 282, 292, 34
Offset: 1

Views

Author

Olivier Gérard, Jun 06 2001

Keywords

Examples

			The 3rd prime is 5 and mod 5, 3^4 = 1, so a(3) = 4.
		

Crossrefs

Cf. A019334 (full reptend primes in base 3).

Programs

  • GAP
    A000040:=Filtered([1..350],IsPrime);;
    List([1..Length(A000040)],n->OrderMod(3,A000040[n])); # Muniru A Asiru, Feb 07 2019
    
  • Mathematica
    Table[With[{p=Prime[n]},If[p==3,0,MultiplicativeOrder[3,p]]],{n,63}] (* Ray Chandler, Apr 06 2016 *)
  • PARI
    a(n,{base=3}) = my(p=prime(n)); if(base%p, znorder(Mod(base,p)), 0) \\ Jianing Song, May 13 2024
  • Python
    from sympy import n_order, prime
    def A062117(n): return n_order(3,prime(n)) if n != 2 else 0 # Chai Wah Wu, Nov 10 2023
    

A211241 Order of 5 mod n-th prime: least k such that prime(n) divides 5^k-1.

Original entry on oeis.org

1, 2, 0, 6, 5, 4, 16, 9, 22, 14, 3, 36, 20, 42, 46, 52, 29, 30, 22, 5, 72, 39, 82, 44, 96, 25, 102, 106, 27, 112, 42, 65, 136, 69, 37, 75, 156, 54, 166, 172, 89, 15, 19, 192, 196, 33, 35, 222, 226, 114, 232, 119, 40, 25, 256, 262, 67, 27, 276, 140, 282, 292
Offset: 1

Views

Author

T. D. Noe, Apr 11 2012

Keywords

Crossrefs

Cf. A019335 (full reptend primes in base 5).

Programs

  • GAP
    A000040:=Filtered([1..350],IsPrime);;
    List([1..Length(A000040)],n->OrderMod(5,A000040[n])); # Muniru A Asiru, Feb 06 2019
    
  • Mathematica
    nn = 5; Table[If[Mod[nn, p] == 0, 0, MultiplicativeOrder[nn, p]], {p, Prime[Range[100]]}]
  • PARI
    a(n,{base=5}) = my(p=prime(n)); if(base%p, znorder(Mod(base,p)), 0) \\ Jianing Song, May 13 2024

A082654 Order of 4 mod n-th prime: least k such that prime(n) divides 4^k-1, n >= 2.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 4, 9, 11, 14, 5, 18, 10, 7, 23, 26, 29, 30, 33, 35, 9, 39, 41, 11, 24, 50, 51, 53, 18, 14, 7, 65, 34, 69, 74, 15, 26, 81, 83, 86, 89, 90, 95, 48, 98, 99, 105, 37, 113, 38, 29, 119, 12, 25, 8, 131, 134, 135, 46, 35, 47, 146, 51, 155, 78, 158
Offset: 1

Views

Author

Gary W. Adamson, May 17 2003

Keywords

Comments

The period of the expansion of 1/p, base N (where N=4), is equivalent to determining for base integer 4, the period of the sequence 1, 4, 4^2, 4^3, ... mod p. Thus the cycle length for base 4, 1/7 = 0.021021021... (cycle length 3).
The cycle length, base 4, mod p, is equivalent to "clock cycles", given angle A, then the algebraic identity for the doubling angle, 2A.
Examples: Given cos A, f(x) for 2A = 2x^2 - 1, seed 2 Pi/7, i.e., (.623489801 == (arrow), -.222520934... == -.900968867...== .623489801...(cycle length 3). Given 2 cos A, the algebraic identity for 2 cos 2A, f(x) = x^2 - 2; e.g., given seed 2 cos A = 2 Pi/7, the 3 cycle is 1.246979604...== .445041867...== -1.801937736...== back to 1.24697... Likewise, the doubling function given sin^2 A, f(x) for sin^2 2A = 4x(1 - x), the logistic equation; getting cycle length of 3 using the seed sin^2 2 Pi/7. Similarly, the doubling function for tan 2A given tan A, where A = 2 Pi/7 gives 2x/(1 - x^2), cycle length of 3. The doubling function for cot 2A given cot A, with A = 2 Pi/7 gives (x^2 - 1)/2x, cycle length of 3. Note that (x^2 - 1)/2x = sinh(log(x)), and is also generated from using Newton's method on x^2 + 1 = 0.
Consider the odd pseudoprimes, composite numbers x such that 2^(x-1) = 1 mod x, that have prime(n) as a factor. It appears that all such x can be factored as prime(n) * (2 a(n) k + 1) for some integer k. For example, the first few pseudoprimes having the factor 31 are 31*11, 31*91, 31*141 and 3*151. The 11th prime is 31 and a(11) = 5. Therefore all the cofactors of 31 should have the form 10k+1, which is clearly true. - T. D. Noe, Jun 10 2003

Examples

			4th prime is 7 and mod 7, 4^3 = 1, but not 4^1 or 4^2, so a(4) = 3.
n = 4: prime(4) = 7, 2^6 - 1 = 63 = 3*21 == 0 (mod 21), but not 2^k - 1 for lower exponents k >= 1, therefore ord(2, 3*7) = 6 and a(4) = 3. - _Wolfdieter Lang_, Apr 10 2020
		

References

  • Albert H. Beiler, Recreations in the Theory of Numbers, Dover, 1964; Table 48, pages 98-99.
  • John H. Conway & R. K. Guy, The Book of Numbers, Springer-Verlag, 1996, pages 207-208, Periodic Points.

Crossrefs

Cf. A053447 (order of 4 mod 2n+1), A216371.

Programs

  • GAP
    A000040:=Filtered([1..350],IsPrime);;
    List([1..Length(A000040)],n->OrderMod(4,A000040[n])); # Muniru A Asiru, Feb 07 2019
  • Mathematica
    Join[{0}, Table[MultiplicativeOrder[4, Prime[n]], {n, 2, 100}]]
  • PARI
    a(n)=if(n>1, znorder(Mod(4,prime(n))), 0) \\ Charles R Greathouse IV, Sep 07 2016
    

Formula

a(1) = 0, and a(n) = order(4, prime(n)), also used exp_{prime(n)}(4), that is least exponent k >= 1 for which 4^k is congruent to 1 mod prime(n), for n >= 2. prime(n) = A000040(n). [rewritten by Wolfdieter Lang, Apr 10 2020]
From Wolfdieter Lang, Apr 10 2020: (Start)
a(n) = A003558(prime(n)), for n >= 2.
a(n) = (1/2)*order(2, 3*prime(n)), for n >= 3. [Proof uses 4^k - 1 = (1+3)^k - 1 == 0 (mod 3), for k >= 0.] (End)
From Jianing Song, May 13 2024: (Start)
a(n) = A014664(n)/gcd(2, A014664(n)).
a(n) <= (prime(n) - 1)/2. Those prime(n) for which a(n) = (prime(n) - 1)/2 are listed in A216371. (End)

Extensions

More terms from Reinhard Zumkeller, May 17 2003

A006556 Number of different cycles of digits in the decimal expansions of 1/p, 2/p, ..., (p-1)/p where p = n-th prime different from 2 or 5.

Original entry on oeis.org

2, 1, 5, 2, 1, 1, 1, 1, 2, 12, 8, 2, 1, 4, 1, 1, 2, 2, 9, 6, 2, 2, 1, 25, 3, 2, 1, 1, 3, 1, 17, 3, 1, 2, 2, 2, 1, 4, 1, 1, 2, 1, 2, 2, 7, 1, 2, 1, 1, 34, 8, 5, 1, 1, 1, 54, 4, 10, 2, 2, 2, 2, 1, 4, 3, 1, 2, 3, 11, 2, 1, 2, 1, 1, 1, 4, 2, 2, 1, 3, 2, 1, 2, 2, 14, 3, 1, 3, 2, 2, 1, 1, 1, 1, 1, 10, 2, 1, 6
Offset: 3

Views

Author

Keywords

Examples

			1/13=.0769230769..., 2/13=.1538461538..., 3/13= .2307692307..., etc., with 2 different cycles, so a(4) = 2 [13 is the 4th prime different from 2 or 5].
		

References

  • J. H. Conway and R. K. Guy, The Book of Numbers, Copernicus Press, NY, 1996, p. 162.
  • M. Kraitchik, Recherches sur la Théorie des Nombres. Gauthiers-Villars, Paris, Vol. 1, 1924, Vol. 2, 1929, see Vol. 1, p. 131.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A048595 and A002371 for the length of the cycles. See also A054471.

Programs

  • Mathematica
    Map[(# - 1)/MultiplicativeOrder[10, #] &, {3}~Join~Prime@ Range[4, 101]] (* Michael De Vlieger, May 27 2020 *)
  • PARI
    f(p) = (p-1)/znorder(Mod(10, p));
    lista(nn) = {my(vp=select(x->(10%x), primes(nn))); apply(f, vp);} \\ Michel Marcus, May 27 2020

Formula

(p-1)/x, where 10^x = 1 mod p.

Extensions

More terms from James Sellers, May 24 2000
Edited by Charles R Greathouse IV, Nov 01 2009
Showing 1-10 of 64 results. Next