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

A141305 Primes p such that q=(p-1)/2 is also prime and 2 is a primitive root mod q; that is, q is in A001122.

Original entry on oeis.org

7, 11, 23, 59, 107, 167, 263, 347, 359, 587, 839, 887, 983, 1019, 1307, 1319, 2039, 2459, 2903, 2999, 3467, 3803, 3863, 3947, 4139, 4283, 4679, 4919, 5099, 5387, 5399, 5483, 5639, 5879, 5927, 6599, 6827, 6983, 7079, 7559, 7607, 7703, 8039, 8699, 8747
Offset: 1

Views

Author

T. D. Noe, Jun 24 2008

Keywords

Comments

These primes are a subset of the safe primes, A005385. These primes produce the longest possible cycles, (p-3)/2, in the squaring mod p map. See A037178.

Crossrefs

Programs

  • Mathematica
    Select[Range[10^4], PrimeQ[#] && PrimeQ[(q = (# - 1)/2)] && PrimitiveRoot[q] == 2 &] (* Amiram Eldar, Oct 09 2021 *)
  • PARI
    isok(p) = isprime(p) && (p%2) && isprime(q=(p-1)/2) && (q%2) && (znorder(Mod(2, q))==(q-1)); \\ Michel Marcus, Jan 30 2016

Extensions

Incorrect term 5 removed by Michel Marcus, Jan 30 2016

A319248 Lesser of the pairs of twin primes in A001122.

Original entry on oeis.org

3, 11, 59, 179, 347, 419, 659, 827, 1451, 1619, 1667, 2027, 2267, 3467, 3851, 4019, 4091, 4259, 4787, 6779, 6827, 6947, 7547, 8219, 8291, 8819, 9419, 10067, 10091, 10139, 10499, 10859, 12251, 12611, 13931, 14387, 14627, 14867, 16067, 16187, 16979, 17387, 17747
Offset: 1

Views

Author

Jianing Song, Sep 15 2018

Keywords

Comments

Primes p such that both p and p + 2 are both in A001122.
Apart from the first term, all terms are congruent to 11 mod 24, since terms in A001359 are congruent to 5 mod 6 apart from the first one, and terms in A001122 are congruent to 3 or 5 mod 8.
Note that "there are infinitely many pairs of twin primes" and "there are infinitely many primes with primitive root 2" are two famous and unsolved problems, so a stronger conjecture implying both of them is that this sequence is infinite.
Also note that a pair of cousin primes can't both appear in A001122, while a pair of sexy primes can.

Examples

			11 and 13 is a pair of twin primes both having 2 as a primitive root, so 11 is a term.
59 and 61 is a pair of twin primes both having 2 as a primitive root, so 59 is a term.
Although 101 and 103 is a pair of twin primes, 101 has 2 as a primitive root while 103 doesn't, so 101 is not a term.
		

Crossrefs

A319249 gives p+2, A319250 gives (p-11)/24.

Programs

  • Mathematica
    Select[Prime[Range[2^11]], PrimeQ[# + 2] && PrimitiveRoot[#] == 2 && PrimitiveRoot[# + 2] == 2 &] (* Amiram Eldar, May 02 2023 *)
  • PARI
    forprime(p=3, 10000, if(znorder(Mod(2,p))==p-1 && znorder(Mod(2,p+2))==p+1, print1(p, ", ")))
    
  • Python
    from itertools import islice
    from sympy import isprime, nextprime, is_primitive_root
    def A319248_gen(): # generator of terms
        p = 2
        while (p:=nextprime(p)):
            if isprime(p+2) and is_primitive_root(2,p) and is_primitive_root(2,p+2):
                yield p
    A319248_list = list(islice(A319248_gen(),30)) # Chai Wah Wu, Feb 13 2023

Formula

a(n) = A319249(n) - 2.
For n >= 2, a(n) = 24*A319250(n-1) + 11.

A319250 Numbers k such that 24k + 11 and 24k + 13 are a pair of twin primes in A001122.

Original entry on oeis.org

0, 2, 7, 14, 17, 27, 34, 60, 67, 69, 84, 94, 144, 160, 167, 170, 177, 199, 282, 284, 289, 314, 342, 345, 367, 392, 419, 420, 422, 437, 452, 510, 525, 580, 599, 609, 619, 669, 674, 707, 724, 739, 797, 854, 865, 875, 895, 899, 900, 942, 952, 959, 984, 1004, 1080
Offset: 1

Views

Author

Jianing Song, Sep 15 2018

Keywords

Comments

Numbers k such that 24k + 11 and 24k + 13 are both in A001122. See A319248 and A319249 for detailed information.

Examples

			11 and 13 are a pair of twin primes both having 2 as a primitive root, so 0 is a term.
59 and 61 are a pair of twin primes both having 2 as a primitive root, so 2 is a term.
Although 227 and 229 are a pair of twin primes, neither of them has 2 as a primitive root, so 9 is not a term.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[0, 1080], PrimeQ[24*# + 11] && PrimeQ[24*# + 13] && PrimitiveRoot[24*# + 11] == 2 && PrimitiveRoot[24*# + 13] == 2 &] (* Amiram Eldar, May 02 2023 *)
  • PARI
    for(k=0, 1000, if(znorder(Mod(2,24*k+11))==24*k+10 && znorder(Mod(2,24*k+13))==24*k+12, print1(k, ", ")))

Formula

a(n) = (A319248(n+1) - 11)/24 = (A319249(n+1) - 13)/24.

A319249 Greater of the pairs of twin primes in A001122.

Original entry on oeis.org

5, 13, 61, 181, 349, 421, 661, 829, 1453, 1621, 1669, 2029, 2269, 3469, 3853, 4021, 4093, 4261, 4789, 6781, 6829, 6949, 7549, 8221, 8293, 8821, 9421, 10069, 10093, 10141, 10501, 10861, 12253, 12613, 13933, 14389, 14629, 14869, 16069, 16189, 16981, 17389, 17749
Offset: 1

Views

Author

Jianing Song, Sep 15 2018

Keywords

Comments

Primes p such that both p - 2 and p are both in A001122.
Apart from the first term, all terms are congruent to 13 mod 24, since terms in A006512 are congruent to 1 mod 6 apart from the first one, and terms in A001122 are congruent to 3 or 5 mod 8.
Note that "there are infinitely many pairs of twin primes" and "there are infinitely many primes with primitive root 2" are two famous and unsolved problems, so a stronger conjecture implying both of them is that this sequence is infinite.
Also note that a pair of cousin primes can't both appear in A001122, while a pair of sexy primes can.

Examples

			11 and 13 is a pair of twin primes both having 2 as a primitive root, so 13 is a term.
59 and 61 is a pair of twin primes both having 2 as a primitive root, so 61 is a term.
Although 137 and 139 is a pair of twin primes, 139 has 2 as a primitive root while 137 doesn't, so 139 is not a term.
		

Crossrefs

A319248 gives p-2, A319250 gives (p-13)/24.

Programs

  • Mathematica
    Select[Prime[Range[2^11]], PrimeQ[# - 2] && PrimitiveRoot[# - 2] == 2 && PrimitiveRoot[#] == 2 &] (* Amiram Eldar, May 02 2023 *)
  • PARI
    forprime(p=3, 10000, if(znorder(Mod(2,p))==p-1 && znorder(Mod(2,p+2))==p+1, print1(p+2, ", ")))
    
  • Python
    from itertools import islice
    from sympy import isprime, nextprime, is_primitive_root
    def A319249_gen(): # generator of terms
        p = 2
        while (p:=nextprime(p)):
            if isprime(p+2) and is_primitive_root(2,p) and is_primitive_root(2,p+2):
                yield p+2
    A319249_list = list(islice(A319249_gen(),30)) # Chai Wah Wu, Feb 13 2023

Formula

a(n) = A319248(n) + 2.
For n >= 2, a(n) = 24*A319250(n-1) + 13.

A141231 Positive integers whose prime factorizations contain only primes from A001122.

Original entry on oeis.org

3, 5, 9, 11, 13, 15, 19, 25, 27, 29, 33, 37, 39, 45, 53, 55, 57, 59, 61, 65, 67, 75, 81, 83, 87, 95, 99, 101, 107, 111, 117, 121, 125, 131, 135, 139, 143, 145, 149, 159, 163, 165, 169, 171, 173, 177, 179, 181, 183, 185, 195, 197, 201, 209, 211, 225, 227, 243, 247, 249
Offset: 1

Views

Author

Vladimir Shevelev, Jun 16 2008

Keywords

Crossrefs

Programs

  • Mathematica
    aQ[n_] := Length[Select[FactorInteger[n][[;; , 1]], # > 1 && PrimitiveRoot@# != 2 &]] == 0; Select[Range[2, 250], aQ] (* Amiram Eldar, Dec 09 2018 *)
  • PARI
    isokp(p) = znorder(Mod(2, p))==(p-1);
    isok(n) = {if ((n>1) && (n % 2), my(f=factor(n)); #select(x->isokp(x), f[, 1]) == #f~; , 0); } \\ Michel Marcus, Dec 09 2018

Extensions

More terms from Michel Marcus, Dec 09 2018

A345388 a(n) = 0, 1, or 2 according to whether A065091(n), the n-th odd prime, is in A001122, A139035, or A268923, respectively.

Original entry on oeis.org

0, 0, 1, 0, 0, 2, 0, 1, 0, 2, 0, 2, 2, 1, 0, 0, 0, 0, 1, 2, 1, 0, 2, 2, 0, 1, 0, 2, 2, 2, 0, 2, 0, 0, 2, 2, 0, 1, 0, 0, 0, 1, 2, 0, 1, 0, 2, 0, 2, 2, 1, 2, 2, 2, 1, 0, 1, 2, 2, 2, 0, 2, 1, 2, 0, 2, 2, 0, 0, 2, 1, 1, 0, 0, 1, 0, 2, 2, 2, 0, 0, 2, 2, 2, 0, 2, 2
Offset: 1

Views

Author

Howard Givner, Jun 17 2021

Keywords

Comments

The three OEIS sequences A001122, A139035, and A268923 are implicitly described in a Zoom lecture that was given May 14, 2021, by James Tanton. Here is a link to the video, followed by a description of how the sequences can be obtained by carrying out the procedure that the speaker described in his talk.
Description of the method:
James Tanton defined GOOD, HALF-GOOD, and BAD odd prime integers and a procedure for determining which of the three categories an odd prime integer belongs to.
Procedure for categorizing an odd prime integer P:
Step 1. Begin with an initial partition (1,P-1) of P.
Step 2. Generate a successor partition, derived from an existing partition.
When (x,y) is an existing partition and x is even, the successor partition is (s,t), where s=x/2 and t=P-s.
When (x,y) is an existing partition and x is odd, the successor partition is (s,t), where t=y/2 and s=P-t.
Step 3. Repeat step 2 until you return to (1,P-1).
He then classified P as either GOOD, HALF-GOOD, or BAD as follows:
P is GOOD when every integer from 1 to P-1 appears among the left parts of the set of generated partitions.
P is HALF-GOOD when P does not meet the requirements for GOOD, but every integer from 1 to P-1 appears somewhere in the set of generated partitions.
P is BAD when P does not meet the requirements for GOOD or HALF-GOOD.
The sequence of GOOD odd prime integers is identical to A001122.
The sequence of HALF-GOOD odd prime integers is identical to A139035.
The sequence of BAD odd prime integers is identical to A268923.

Examples

			For P=5, the generated partition set is:
  (1,4), (3,2), (4,1), (2,3), (1,4), and thus 5 is GOOD, so a(2)=0.
For P=7, the generated partition set is:
  (1,6), (4,3), (2,5), (1,6), and thus 7 is HALF-GOOD, so a(3)=1.
For P=17, the generated partition set is:
  (1,16), (9,8), (13,4), (15,2), (16,1), (8,9), (4,13), (2,15), (1,16),
  but 3, 5, 6, 7, 10, 11, 12, and 14 do not appear, and thus 17 is BAD, so a(6)=2.
		

Crossrefs

Extensions

Name edited by Felix Fröhlich, Jun 28 2021

A002326 Multiplicative order of 2 mod 2n+1.

Original entry on oeis.org

1, 2, 4, 3, 6, 10, 12, 4, 8, 18, 6, 11, 20, 18, 28, 5, 10, 12, 36, 12, 20, 14, 12, 23, 21, 8, 52, 20, 18, 58, 60, 6, 12, 66, 22, 35, 9, 20, 30, 39, 54, 82, 8, 28, 11, 12, 10, 36, 48, 30, 100, 51, 12, 106, 36, 36, 28, 44, 12, 24, 110, 20, 100, 7, 14, 130, 18, 36, 68, 138, 46, 60, 28
Offset: 0

Views

Author

Keywords

Comments

In other words, least m > 0 such that 2n+1 divides 2^m-1.
Number of riffle shuffles of 2n+2 cards required to return a deck to initial state. A riffle shuffle replaces a list s(1), s(2), ..., s(m) with s(1), s((i/2)+1), s(2), s((i/2)+2), ... a(1) = 2 because a riffle shuffle of [1, 2, 3, 4] requires 2 iterations [1, 2, 3, 4] -> [1, 3, 2, 4] -> [1, 2, 3, 4] to restore the original order.
Concerning the complexity of computing this sequence, see for example Bach and Shallit, p. 115, exercise 8.
It is not difficult to prove that if 2n+1 is a prime then 2n is a multiple of a(n). But the converse is not true. Indeed, one can prove that a(2^(2t-1))=4t. Thus if n=2^(2t-1), where, for any m > 0, t=2^(m-1) then 2n is a multiple of a(n) while 2n+1 is a Fermat number which, as is well known, is not always a prime. It is an interesting problem to describe all composite numbers for which 2n is divisible by a(n). - Vladimir Shevelev, May 09 2008
For an algorithm of calculation of a(n) see author's comment in A179680. - Vladimir Shevelev, Jul 21 2010
From V. Raman, Sep 18 2012, Dec 10 2012: (Start)
If 2n+1 is prime, then the polynomial (x^(2n+1)+1)/(x+1) factors into 2n/a(n) polynomials of the same degree a(n) over GF(2).
If (x^(2n+1)+1)/(x+1) is irreducible over GF(2), then 2n+1 is prime, and 2 is a primitive root (mod 2n+1) (cf. A001122).
For all n > 0, a(n) is the degree of the largest irreducible polynomial factor for the polynomial (x^(2n+1)+1)/(x+1) over GF(2). (End)
a(n) is a factor of phi(2n+1) (A000010(2n+1)). - Douglas Boffey, Oct 21 2013
Conjecture: if p is an odd prime then a((p^3-1)/2) = p * a((p^2-1)/2). Because otherwise a((p^3-1)/2) < p * a((p^2-1)/2) iff a((p^3-1)/2) = a((p-1)/2) for a prime p. Equivalently p^3 divides 2^(p-1)-1, but no such prime p is known. - Thomas Ordowski, Feb 10 2014
A generalization of the previous conjecture: For each k>=2, if p is an odd prime then a(((p^(k+1))-1)/2) = p * a((p^k-1)/2). Computer testing of this generalized conjecture shows that there is no counterexample for k and p both up to 1000. - Ahmad J. Masad, Oct 17 2020

Examples

			From _Vladimir Shevelev_, Oct 03 2017: (Start)
Our algorithm for the calculation of a(n) in the author's comment in A179680 (see also the Sage program below) could be represented in the form of a "finite continued fraction". For example let n = 8, 2*n+1 = 17. We have
    1 + 17
    ------- + 17
       2
    ------------- + 17
           2
    ------------------- + 17
              2
    -------------------------- = 1
                 32
Here the denominators are the A006519 of the numerators: A006519(1+17) = 2, A006519(9+17) = 2, A006519(13+17) = 2, A006519(15+17) = 32. Summing the exponents of these powers of 2, we obtain the required result: a(8) = 1 + 1 + 1 + 5 = 8. Indeed, we have (((1*32 - 17)*2 - 17)*2 - 17)*2 - 17 = 1. So 32*2*2*2 - 1 == 0 (mod 17), 2^8 - 1 == 0 (mod 17). In the general case, note that all "partial fractions" (which indeed are integers) are odd residues modulo 2*n+1 in the interval [1, 2*n-1]. It is easy to prove that the first 1 appears not later than in the n-th step. (End)
		

References

  • E. Bach and Jeffrey Shallit, Algorithmic Number Theory, I.
  • T. Folger, "Shuffling Into Hyperspace," Discover, 1991 (vol 12, no 1), pages 66-67.
  • M. Gardner, "Card Shuffles," Mathematical Carnival chapter 10, pages 123-138. New York: Vintage Books, 1977.
  • L. Lunelli and M. Lunelli, Tavola di congruenza a^n == 1 mod K per a=2,5,10, Atti Sem. Mat. Fis. Univ. Modena 10 (1960/61), 219-236 (1961).
  • J. H. Silverman, A Friendly Introduction to Number Theory, 3rd ed., Pearson Education, Inc, 2006, p. 146, Exer. 21.3
  • 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

Cf. A024222, A006694 (number of cyclotomic cosets).
Cf. A014664 (order of 2 mod n-th prime).
Cf. A001122 (primes for which 2 is a primitive root).
Cf. A216838 (primes for which 2 is not a primitive root).
Bisections give A274298, A274299.
Partial sums: A359147.

Programs

  • GAP
    List([0..100],n->OrderMod(2,2*n+1)); # Muniru A Asiru, Feb 01 2019
    
  • Haskell
    import Data.List (findIndex)
    import Data.Maybe (fromJust)
    a002326 n = (+ 1) $ fromJust $
                findIndex ((== 0) . (`mod` (2 * n + 1))) $ tail a000225_list
    -- Reinhard Zumkeller, Apr 22 2013
    
  • Magma
    [ 1 ] cat [ Modorder(2, 2*n+1): n in [1..72] ]; // Klaus Brockhaus, Dec 03 2008
    
  • Maple
    a := n -> `if`(n=0, 1, numtheory:-order(2, 2*n+1)):
    seq(a(n), n=0..72);
  • Mathematica
    Table[MultiplicativeOrder[2, 2*n + 1], {n, 0, 100}] (* Robert G. Wilson v, Apr 05 2011 *)
  • PARI
    a(n)=if(n<0,0,znorder(Mod(2,2*n+1))) /* Michael Somos, Mar 31 2005 */
    
  • Python
    from sympy import n_order
    [n_order(2, 2*n+1) for n in range(73)] # Hermann Stamm-Wilbrandt, Jul 27 2021
  • Sage
    # From Peter Luschny, Oct 06 2017: (Start)
    [Mod(2,n).multiplicative_order() for n in (0..145) if gcd(n,2) == 1]
    # Algorithm from Vladimir Shevelev as described in A179680 and presented in Example.
    def A002326VS(n):
        s, m, N = 0, 1, 2*n + 1
        while True:
            k = N + m
            v = valuation(k, 2)
            s += v
            m = k >> v
            if m == 1: break
        return s
    [A002326VS(n) for n in (0..72)] # (End)
    

Formula

a((3^n-1)/2) = A025192(n). - Vladimir Shevelev, May 09 2008
Bisection of A007733: a(n) = A007733(2*n+1). - Max Alekseyev, Jun 11 2009
a((b(n)-1)/2) = n for odd n and even n such that b(n/2) != b(n), where b(n) = A005420(n). - Thomas Ordowski, Jan 11 2014
Note that a(2^n-1) = n+1 and a(2^n) = 2*(n+1). - Thomas Ordowski, Jan 16 2014
a(n) = A056239(A292239(n)) = A048675(A292265(n)). - Antti Karttunen, Oct 04 2017

Extensions

More terms from David W. Wilson, Jan 13 2000
More terms from Benoit Cloitre, Apr 11 2003

A005596 Decimal expansion of Artin's constant Product_{p=prime} (1-1/(p^2-p)).

Original entry on oeis.org

3, 7, 3, 9, 5, 5, 8, 1, 3, 6, 1, 9, 2, 0, 2, 2, 8, 8, 0, 5, 4, 7, 2, 8, 0, 5, 4, 3, 4, 6, 4, 1, 6, 4, 1, 5, 1, 1, 1, 6, 2, 9, 2, 4, 8, 6, 0, 6, 1, 5, 0, 0, 4, 2, 0, 9, 4, 7, 4, 2, 8, 0, 2, 4, 1, 7, 3, 5, 0, 1, 8, 2, 0, 4, 0, 0, 2, 8, 0, 8, 2, 3, 4, 4, 3, 0, 4, 3, 1, 7, 0, 8, 7, 2, 5, 0, 5, 6, 8, 9, 8, 1, 6, 0, 3
Offset: 0

Views

Author

Keywords

Comments

On Simon Plouffe's web page (and in the book freely available at Gutenberg project) the value is given with an error of +1e-31, as "...651641..." instead of "...641641...". In the reference [Wrench, 1961] cited there, these digits are correct. They are also correct on the Plouffe's Inverter page, as computed by Oliveira e Silva, who comments it took 1 hour at 200 MHz with Mathematica. Using Amiram Eldar's PARI program, the same 500 digits are computed instantly (less than 0.1 sec). - M. F. Hasler, Apr 20 2021
Named after the Austrian mathematician Emil Artin (1898-1962). - Amiram Eldar, Jun 20 2021

Examples

			0.37395581361920228805472805434641641511162924860615...
		

References

  • Henri Cohen, Number Theory, Volume II: Analytic and Modern Tools, GTM Vol. 240, Springer, 2007; see pp. 208-209.
  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 169.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    a = Exp[-NSum[ (LucasL[n] - 1)/n PrimeZetaP[n], {n, 2, Infinity}, PrecisionGoal -> 500, WorkingPrecision -> 500, NSumTerms -> 100000]]; RealDigits[a, 10, 111][[1]] (* Robert G. Wilson v, Sep 03 2014 taken from Mathematica's Help file on PrimeZetaP *)
  • PARI
    prodinf(n=2,1/zeta(n)^(sumdiv(n, d, moebius(n/d)*(fibonacci(d-1)+fibonacci(d+1)))/n)) \\ Charles R Greathouse IV, Aug 27 2014
    
  • PARI
    prodeulerrat(1-1/(p^2-p)) \\ Amiram Eldar, Mar 12 2021

Formula

Equals Product_{j>=2} 1/Zeta(j)^A006206(j), where Zeta = A013661, A002117 etc. is Riemann's zeta function. - R. J. Mathar, Feb 14 2009
Equals Sum_{k>=1} mu(k)/(k*phi(k)), where mu is the Moebius function (A008683) and phi is the Euler totient function (A000010). - Amiram Eldar, Mar 11 2020
Equals 1/A065488. - Vaclav Kotesovec, Jul 17 2021

Extensions

More terms from Tomás Oliveira e Silva (http://www.ieeta.pt/~tos)

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
Showing 1-10 of 146 results. Next