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

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

A053447 Multiplicative order of 4 mod 2n+1.

Original entry on oeis.org

1, 1, 2, 3, 3, 5, 6, 2, 4, 9, 3, 11, 10, 9, 14, 5, 5, 6, 18, 6, 10, 7, 6, 23, 21, 4, 26, 10, 9, 29, 30, 3, 6, 33, 11, 35, 9, 10, 15, 39, 27, 41, 4, 14, 11, 6, 5, 18, 24, 15, 50, 51, 6, 53, 18, 18, 14, 22, 6, 12, 55, 10, 50, 7, 7, 65, 9, 18, 34, 69, 23, 30, 14, 21, 74, 15, 12, 10, 26
Offset: 0

Views

Author

Keywords

Comments

For a set S = {x, y} (x < y), let f(S) = {2x, y - x}, then a(n) is the smallest k > 0 such that f_k({1, 2n}) = {1, 2n} where f_k(S) denotes iteration for k times. E.g., for n = 3 we have: f_1({1, 6}) = f({1, 6}) = {2, 5}, f_2({1, 6}) = f({2, 5}) = {3, 4}, f_3({1, 6}) = f({3, 4}) = {1, 6}. - Jianing Song, Jan 27 2019
From Jianing Song, Dec 24 2022: (Start)
Let psi = A002322. For n > 0, we have 4^(psi(2*n+1)/2) = 2^psi(2*n+1) == 1 (mod 2*n+1), so a(n) divides psi(2*n+1)/2 => a(n) <= psi(2*n+1)/2 <= n. a(n) = psi(2*n+1)/2 if and only if one of the two following conditions holds: (a) the multiplicative order of 2 modulo 2*n+1 is psi(2*n+1); (b) the multiplicative order of 2 modulo 2*n+1 is psi(2*n+1)/2, and psi(2*n+1) == 2 (mod 4).
Additionally, a(n) = n if and only if 2*n+1 = p is a prime, and one of the two following conditions holds: (a) 2 is a primitive root modulo p; (b) p == 3 (mod 4), and the multiplicative order of 2 modulo p is (p-1)/2 (in this case, we have p == 7 (mod 8) since 2 is a quadratic residue modulo p). Such primes p are listed in A216371. (End)

Crossrefs

Programs

  • GAP
    List([0..80],n->OrderMod(4,2*n+1)); # Muniru A Asiru, Feb 25 2019
  • Magma
    [1] cat [Modorder(4, 2*n+1): n in [1..100]]; // Vincenzo Librandi, Apr 01 2014
    
  • Mathematica
    Table[ MultiplicativeOrder[4, n], {n, 1, 160, 2}] (* Robert G. Wilson v, Apr 05 2011 *)
  • PARI
    a(n) = znorder(Mod(4, 2*n+1)); \\ Michel Marcus, Feb 05 2015
    

Formula

Let b = A002326, then a(n) = b(n) if b(n) is odd, otherwise a(n) = b(n)/2. - Joerg Arndt, Feb 03 2019

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

Original entry on oeis.org

0, 2, 4, 1, 10, 4, 8, 6, 11, 28, 5, 12, 20, 14, 23, 52, 58, 20, 22, 35, 3, 13, 82, 11, 16, 100, 17, 106, 12, 28, 7, 130, 68, 46, 148, 5, 52, 54, 83, 172, 178, 60, 95, 32, 196, 33, 70, 37, 226, 76, 29, 119, 8, 50, 16, 131, 268, 45, 92, 70, 94, 292, 34, 155, 52
Offset: 1

Views

Author

T. D. Noe, Apr 11 2012

Keywords

Crossrefs

Cf. A053451 (order of 8 mod 2n+1), A019338 (full reptend primes in base 8).

Programs

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

Formula

a(n) = A014664(n)/gcd(3, A014664(n)). - Jianing Song, May 13 2024

A059890 a(n) = |{m : multiplicative order of 8 mod m = n}|.

Original entry on oeis.org

2, 4, 2, 18, 6, 24, 10, 72, 4, 84, 14, 462, 14, 128, 54, 672, 30, 124, 14, 4494, 82, 364, 14, 7608, 120, 172, 56, 9054, 62, 3920, 6, 5376, 238, 1500, 1518, 9600, 62, 364, 494, 69048, 30, 5892, 30, 24174, 956, 364, 62, 253280, 52, 12072, 222, 147246, 254, 12072
Offset: 1

Views

Author

Vladeta Jovovic, Feb 06 2001

Keywords

Comments

The multiplicative order of a mod m, gcd(a,m)=1, is the smallest natural number d for which a^d = 1 (mod m). a(n) = number of orders of degree-n monic irreducible polynomials over GF(8).
Also, number of primitive factors of 8^n - 1. - Max Alekseyev, May 03 2022

Crossrefs

Number of primitive factors of b^n - 1: A059499 (b=2), A059885(b=3), A059886 (b=4), A059887 (b=5), A059888 (b=6), A059889 (b=7), this sequence (b=8), A059891 (b=9), A059892 (b=10).
Column k=8 of A212957.

Programs

  • Maple
    with(numtheory):
    a:= n-> add(mobius(n/d)*tau(8^d-1), d=divisors(n)):
    seq(a(n), n=1..40);  # Alois P. Heinz, Oct 12 2012
  • Mathematica
    a[n_] := Sum[MoebiusMu[n/d]*DivisorSigma[0, 8^d-1], {d, Divisors[n]}];
    Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Jan 13 2025, after Alois P. Heinz *)
  • PARI
    a(n) = sumdiv(n, d, moebius(n/d) * numdiv(8^d-1)); \\ Amiram Eldar, Jan 25 2025

Formula

a(n) = Sum_{ d divides n } mu(n/d)*tau(8^d-1), (mu(n) = Moebius function A008683, tau(n) = number of divisors of n A000005).

A070677 Smallest m in range 1..phi(n) such that 5^m == 1 mod n, or 0 if no such number exists.

Original entry on oeis.org

0, 1, 2, 1, 0, 2, 6, 2, 6, 0, 5, 2, 4, 6, 0, 4, 16, 6, 9, 0, 6, 5, 22, 2, 0, 4, 18, 6, 14, 0, 3, 8, 10, 16, 0, 6, 36, 9, 4, 0, 20, 6, 42, 5, 0, 22, 46, 4, 42, 0, 16, 4, 52, 18, 0, 6, 18, 14, 29, 0, 30, 3, 6, 16, 0, 10, 22, 16, 22, 0, 5, 6, 72, 36, 0, 9, 30, 4, 39, 0
Offset: 1

Views

Author

N. J. A. Sloane and Amarnath Murthy, May 08 2002

Keywords

Crossrefs

Programs

  • Magma
    [0] cat [Modorder(5, n): n in [2..100]]; // Vincenzo Librandi, Apr 01 2014
    
  • Mathematica
    Table[SelectFirst[Range[EulerPhi[n]], PowerMod[5, #, n] == 1 &, 0],{n, 80}] (* Paul F. Marrero Romero, Oct 04 2024 *)
  • Python
    from sympy import n_order
    def A070677(n): return n_order(5,n) if n%5 and n>1 else 0 # Chai Wah Wu, Feb 23 2023

A070682 Smallest m in range 1..phi(2n+1) such that 10^m == 1 mod 2n+1, or 0 if no such number exists.

Original entry on oeis.org

0, 1, 0, 6, 1, 2, 6, 0, 16, 18, 6, 22, 0, 3, 28, 15, 2, 0, 3, 6, 5, 21, 0, 46, 42, 16, 13, 0, 18, 58, 60, 6, 0, 33, 22, 35, 8, 0, 6, 13, 9, 41, 0, 28, 44, 6, 15, 0, 96, 2, 4, 34, 0, 53, 108, 3, 112, 0, 6, 48, 22, 5, 0, 42, 21, 130, 18, 0, 8, 46, 46, 6, 0, 42, 148
Offset: 0

Views

Author

N. J. A. Sloane and Amarnath Murthy, May 08 2002

Keywords

Crossrefs

Programs

  • PARI
    a(n) = {for (m = 1, eulerphi(2*n+1), if (10^m % (2*n+1) == 1, return (m));); return (0);} \\ Michel Marcus, Sep 14 2013

A070683 Smallest m in range 1..phi(2n+1) such that 12^m == 1 mod 2n+1, or 0 if no such number exists.

Original entry on oeis.org

0, 0, 4, 6, 0, 1, 2, 0, 16, 6, 0, 11, 20, 0, 4, 30, 0, 12, 9, 0, 40, 42, 0, 23, 42, 0, 52, 4, 0, 29, 15, 0, 4, 66, 0, 35, 36, 0, 6, 26, 0, 41, 16, 0, 8, 6, 0, 12, 16, 0, 100, 102, 0, 53, 54, 0, 112, 44, 0, 48, 11, 0, 100, 126, 0, 65, 6, 0, 136, 138, 0, 2, 4, 0, 148
Offset: 0

Views

Author

N. J. A. Sloane and Amarnath Murthy, May 08 2002

Keywords

Comments

a(n)=2*n if 2*n+1 is in A019340, otherwise a(n)<2*n. - Robert Israel, Apr 17 2019

Crossrefs

Programs

  • Maple
    f:= proc(n)
      if n mod 3 = 1 then 0 else numtheory:-order(12,2*n+1) fi
    end proc:
    0, seq(f(n),n=1..100); # Robert Israel, Apr 16 2019
  • Mathematica
    a[n_] := Module[{s}, s = SelectFirst[Range[EulerPhi[2n+1]], PowerMod[12, #, 2n+1] == 1&]; If[s === Missing["NotFound"], 0, s]];
    a /@ Range[0, 100] (* Jean-François Alcover, Jun 04 2020 *)

A070678 Smallest m in range 1..phi(n) such that 7^m == 1 mod n, or 0 if no such number exists.

Original entry on oeis.org

0, 1, 1, 2, 4, 1, 0, 2, 3, 4, 10, 2, 12, 0, 4, 2, 16, 3, 3, 4, 0, 10, 22, 2, 4, 12, 9, 0, 7, 4, 15, 4, 10, 16, 0, 6, 9, 3, 12, 4, 40, 0, 6, 10, 12, 22, 23, 2, 0, 4, 16, 12, 26, 9, 20, 0, 3, 7, 29, 4, 60, 15, 0, 8, 12, 10, 66, 16, 22, 0, 70, 6, 24, 9, 4, 6, 0, 12
Offset: 1

Views

Author

N. J. A. Sloane and Amarnath Murthy, May 08 2002

Keywords

Crossrefs

Programs

  • Magma
    [0] cat [Modorder(7, n): n in [2..100]]; // Vincenzo Librandi, Apr 01 2014
  • Mathematica
    Table[SelectFirst[Range[EulerPhi[n]],PowerMod[7,#,n]==1&],{n,80}]/.(Missing["NotFound"]->0) (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 25 2019 *)

A070679 Smallest m in range 1..phi(n) such that 9^m == 1 mod n, or 0 if no such number exists.

Original entry on oeis.org

0, 1, 0, 1, 2, 0, 3, 1, 0, 2, 5, 0, 3, 3, 0, 2, 8, 0, 9, 2, 0, 5, 11, 0, 10, 3, 0, 3, 14, 0, 15, 4, 0, 8, 6, 0, 9, 9, 0, 2, 4, 0, 21, 5, 0, 11, 23, 0, 21, 10, 0, 3, 26, 0, 10, 3, 0, 14, 29, 0, 5, 15, 0, 8, 6, 0, 11, 8, 0, 6, 35, 0, 6, 9, 0, 9, 15, 0, 39, 2, 0, 4, 41, 0
Offset: 1

Views

Author

N. J. A. Sloane and Amarnath Murthy, May 08 2002

Keywords

Crossrefs

Programs

  • Magma
    [0] cat [Modorder(9, n): n in [2..100]]; // Vincenzo Librandi, Apr 01 2014
  • Mathematica
    Table[SelectFirst[Range[EulerPhi[n]],PowerMod[9,#,n]==1&],{n,90}]/. Missing[ "NotFound"] -> 0 (* Harvey P. Dale, Jan 22 2023 *)
  • PARI
    a(n) = {for (i = 1, eulerphi(n), if ((9^i % n) == 1, return(i));); return (0);} \\Michel Marcus, Jul 31 2013
    

A070676 Smallest m in range 1..phi(n) such that 3^m == 1 mod n, or 0 if no such number exists.

Original entry on oeis.org

0, 1, 0, 2, 4, 0, 6, 2, 0, 4, 5, 0, 3, 6, 0, 4, 16, 0, 18, 4, 0, 5, 11, 0, 20, 3, 0, 6, 28, 0, 30, 8, 0, 16, 12, 0, 18, 18, 0, 4, 8, 0, 42, 10, 0, 11, 23, 0, 42, 20, 0, 6, 52, 0, 20, 6, 0, 28, 29, 0, 10, 30, 0, 16, 12, 0, 22, 16, 0, 12, 35, 0, 12, 18, 0, 18, 30, 0
Offset: 1

Views

Author

N. J. A. Sloane and Amarnath Murthy, May 08 2002

Keywords

Crossrefs

Programs

  • Magma
    [0] cat [Modorder(3, n): n in [2..100]]; // Vincenzo Librandi, Apr 01 2014
  • Mathematica
    Table[SelectFirst[Range[EulerPhi[n]],PowerMod[3,# ,n]==1&,0],{n,80}] (* The program uses the SelectFirst function from Mathematica version 10 *) (* Harvey P. Dale, Aug 18 2015 *)
Showing 1-10 of 15 results. Next