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 20 results. Next

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

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

Original entry on oeis.org

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, 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

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]
Numbers n such that A071126(n) = A000040(n) - 1. - Hugo Pfoertner, Mar 18 2003
Except for n = 1 and 3, a(n) divides A006093(n). - Robert Israel, Jul 15 2016

Examples

			A002371(11) = 15 because the 11th prime is 31, and 1/31 = 0.03225806451612903225806451612903225806452... has period 15. - _Richard F. Lyon_, Mar 29 2022
		

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, 1996, p. 162. ISBN 978-0-387-97993-9.
  • 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).

Crossrefs

See A048595 for another version. Cf. A006883, A007732, A051626, A071126, A000040, A002275, A097443.
Cf. A001913 (full repetend primes), A060257 (1/prime(n) has period prime(n) - 1).

Programs

  • 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 *)
  • 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

Formula

From Alexander Adamchuk, Jan 28 2007: (Start)
a(A000720(p)) = p - 1 for primes p in A001913.
a(A060257(n)) = prime(A060257(n)) - 1. (End)

Extensions

More terms from Arlin Anderson (starship1(AT)gmail.com)
Edited by Charles R Greathouse IV, Mar 24 2010

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

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

Original entry on oeis.org

0, 0, 1, 2, 10, 12, 16, 9, 11, 14, 6, 4, 40, 3, 23, 26, 58, 60, 33, 35, 36, 78, 82, 88, 12, 10, 102, 106, 108, 112, 126, 130, 136, 23, 37, 150, 156, 27, 83, 43, 178, 60, 19, 96, 14, 198, 105, 222, 226, 228, 232, 17, 20, 250, 256, 131, 134, 270, 276, 56, 141
Offset: 1

Views

Author

T. D. Noe, Apr 11 2012

Keywords

Crossrefs

Cf. A019336 (full reptend primes in base 6).

Programs

  • GAP
    A000040:=Filtered([1..350],IsPrime);;
    List([1..Length(A000040)],n->OrderMod(6,A000040[n])); # Muniru A Asiru, Feb 06 2019
    
  • Maple
    A211242 := proc(n)
        if n<= 2 then
            0 ;
        else
            numtheory[order](6,ithprime(n)) ;
        end if;
    end proc:
    seq(A211242(n),n=1..80) ; # R. J. Mathar, Jul 17 2024
  • Mathematica
    nn = 6; Table[If[Mod[nn, p] == 0, 0, MultiplicativeOrder[nn, p]], {p, Prime[Range[100]]}]
  • PARI
    a(n,{base=6}) = my(p=prime(n)); if(base%p, znorder(Mod(base,p)), 0) \\ Jianing Song, May 13 2024

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

Original entry on oeis.org

1, 0, 2, 3, 5, 3, 8, 9, 11, 14, 15, 9, 4, 21, 23, 26, 29, 5, 11, 35, 6, 39, 41, 44, 24, 50, 17, 53, 27, 56, 63, 65, 68, 69, 74, 25, 39, 81, 83, 86, 89, 45, 95, 8, 98, 99, 105, 111, 113, 57, 116, 119, 60, 125, 128, 131, 134, 15, 69, 140, 141, 146, 17, 155, 39
Offset: 1

Views

Author

T. D. Noe, Apr 11 2012

Keywords

Crossrefs

Programs

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

Formula

From Jianing Song, May 13 2024: (Start)
a(n) = A062117(n)/gcd(2, A062117(n)).
a(n) <= (prime(n) - 1)/2. Those prime(n) for which a(n) = (prime(n) - 1)/2 are listed in A364867. (End)

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

Original entry on oeis.org

1, 1, 4, 0, 10, 12, 16, 3, 22, 7, 15, 9, 40, 6, 23, 26, 29, 60, 66, 70, 24, 78, 41, 88, 96, 100, 51, 106, 27, 14, 126, 65, 68, 69, 74, 150, 52, 162, 83, 172, 178, 12, 10, 24, 98, 99, 210, 37, 113, 228, 116, 238, 240, 125, 256, 262, 268, 135, 138, 20, 141, 292
Offset: 1

Views

Author

T. D. Noe, Apr 11 2012

Keywords

Crossrefs

Cf. A019337 (full reptend primes in base 7).
Row lengths of A201911. - Michel Marcus, Feb 04 2019

Programs

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

A337878 a(n) is the smallest m > 0 such that the n-th prime divides Jacobsthal(m).

Original entry on oeis.org

3, 4, 6, 5, 12, 8, 9, 22, 28, 10, 36, 20, 7, 46, 52, 29, 60, 33, 70, 18, 78, 41, 22, 48, 100, 102, 53, 36, 28, 14, 65, 68, 69, 148, 30, 52, 81, 166, 172, 89, 180, 190, 96, 196, 198, 105, 74, 113, 76, 58, 238, 24, 25, 16, 262, 268, 270, 92, 35, 47, 292, 51
Offset: 2

Views

Author

A.H.M. Smeets, Sep 27 2020

Keywords

Comments

All positive Jacobsthal numbers are odd, so the index starts at n = 2.
The set of primitive prime factors of J_k is given by {A000040(j) | a(j) = k}.
By definition, a(n) is the multiplicative order of -2 modulo the n-th prime for n > 2. - Jianing Song, Jun 20 2025

Examples

			The 4th prime number is 7, and 7 divides 21 which is Jacobsthal(6), so a(4) = 6. The second prime number, 3, divides Jacobsthal(6) as well, but it divides also the smaller Jacobsthal(3), i.e., a(2) = 3.
		

Crossrefs

Cf. A000040 (primes), A001045 (Jacobsthal numbers), A001602 (similar for Fibonacci numbers), A105874 (primes having primitive root -2), A129738.
Cf. multiplicative orders of 2..10: A014664, A062117, A082654, A211241, A211242, A211243, A211244, A211245, A002371.
Cf. multiplicative orders of -2..-10: this sequence (if first term 1), A380482, A380531, A380532, A380533, A380540, A380541, A380542, A385222.

Programs

  • Mathematica
    m = 300; j = LinearRecurrence[{1, 2}, {3, 5}, m]; s = {}; p = 3; While[(ind = Select[Range[m], Divisible[j[[#]], p] &, 1]) != {}, AppendTo[s, ind[[1]] + 2]; p = NextPrime[p]]; s (* Amiram Eldar, Sep 28 2020 *)
  • PARI
    J(n) = (2^n - (-1)^n)/3; \\ A001045
    a(n) = {my(k=1, p=prime(n)); while (J(k) % p, k++); k;} \\ Michel Marcus, Sep 29 2020
  • Python
    n = 1
    while n < 63:
        n, J0, J1, a = n+1, 3, 1, 3
        p = A000040(n)
        J0 = J0%p
        while J0 != 0:
            J0, J1, a = (J0+2*J1)%p, J0, a+1
        print(n,a)
    

Formula

A000040(n) == 1 (mod a(n)) for n > 2.

A380482 a(n) is the multiplicative order of -3 modulo prime(n); a(2) = 0 for completion.

Original entry on oeis.org

1, 0, 4, 3, 10, 6, 16, 9, 22, 28, 15, 9, 8, 21, 46, 52, 58, 5, 11, 70, 12, 39, 82, 88, 48, 100, 17, 106, 54, 112, 63, 130, 136, 69, 148, 25, 39, 81, 166, 172, 178, 90, 190, 16, 196, 99, 105, 111, 226, 114, 232, 238, 120, 250, 256, 262, 268, 15, 138, 280
Offset: 1

Views

Author

Jianing Song, Jun 27 2025

Keywords

Crossrefs

Cf. A105875 (primes having primitive root -3).
Cf. bases -2..-10: A337878 (if first term 1), this sequence, A380531, A380532, A380533, A380540, A380541, A380542, A385222.

Programs

  • Mathematica
    A380482[n_] := If[n == 2, 0, MultiplicativeOrder[-3, Prime[n]]];
    Array[A380482, 100] (* Paolo Xausa, Jun 29 2025 *)
  • PARI
    a(n,{k=-3}) = my(p = prime(n)); if(k%p==0, 0, znorder(Mod(k,p)))
Showing 1-10 of 20 results. Next