A002326 Multiplicative order of 2 mod 2n+1.
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
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).
Links
- T. D. Noe, Table of n, a(n) for n = 0..10000
- Jean-Paul Allouche, Manon Stipulanti, and Jia-Yan Yao, Doubling modulo odd integers, generalizations, and unexpected occurrences, arXiv:2504.17564 [math.NT], 2025.
- M. Baake, U. Grimm and J. Nilsson, Scaling of the Thue-Morse diffraction measure, arXiv preprint arXiv:1311.4371 [math-ph], 2013.
- D. Bayer and P. Diaconis, Trailing the dovetail shuffle to its lair, Ann. Appl. Prob. 2 (2) (1992) 294-313.
- Matthew Brand, Choosing 1 of N with and without lucky numbers, arXiv:1808.07994 [math.NT], 2018.
- J. Brillhart, J. S. Lomont and P. Morton, Cyclotomic properties of the Rudin-Shapiro polynomials, J. Reine Angew. Math.288 (1976), 37--65. See Table 2. MR0498479 (58 #16589).
- Steve Butler, Persi Diaconis and R. L. Graham, The mathematics of the flip and horseshoe shuffles, arXiv:1412.8533 [math.CO], 2014.
- Steve Butler, Persi Diaconis and R. L. Graham, The mathematics of the flip and horseshoe shuffles, The American Mathematical Monthly 123.6 (2016): 542-556.
- A. J. C. Cunningham, On Binal Fractions, Math. Gaz., 4 (71) (1908), circa p. 266.
- P. Diaconis, R. L. Graham, and W. M. Kantor, The mathematics of perfect shuffles, Adv. Appl. Math. 4 (2) (1983) 175-196
- M. J. Gardner and C. A. McMahan, Riffling casino checks, Math. Mag., 50 (1) (1977), 38-41.
- S. W. Golomb, Permutations by cutting and shuffling, SIAM Rev., 3 (1961), 293-297.
- Jonas Kaiser, On the relationship between the Collatz conjecture and Mersenne prime numbers, arXiv preprint arXiv:1608.00862 [math.GM], 2016.
- Torleiv Klove, On covering sets for limited-magnitude errors, Cryptogr. Commun. 8 (3) (2016) 415-433
- V. I. Levenshtein, Conflict-avoiding codes and cyclic triple systems [in Russian], Problemy Peredachi Informatsii, 43 (No. 3, 2007), 39-53.
- V. I. Levenshtein, Conflict-avoiding codes and cyclic triple systems, Problems of Information Transmission, September 2007, Volume 43, Issue 3, pp 199-212 (translated from Russian)
- Yuan-Hsun Lo, Kenneth W. Shum, Wing Shing Wong and Yijin Zhang, Multichannel Conflict-Avoiding Codes of Weights Three and Four, arXiv:2009.11754 [cs.IT], 2020.
- Jarkko Peltomäki and Aleksi Saarela, Standard words and solutions of the word equation X_1^2 ... X_n^2 = (X_1 ... X_n)^2, Journal of Combinatorial Theory, Series A (2021) Vol. 178, 105340. See also arXiv:2004.14657 [cs.FL], 2020.
- Vladimir Shevelev, Gilberto Garcia-Pulgarin, Juan Miguel Velasquez-Soto and John H. Castillo, Overpseudoprimes, and Mersenne and Fermat numbers as primover numbers, arXiv preprint arXiv:1206:0606 [math.NT], 2012.
- Vladimir Shevelev, G. Garcia-Pulgarin, J. M. Velasquez and J. H. Castillo, Overpseudoprimes, and Mersenne and Fermat Numbers as Primover Numbers, J. Integer Seq. 15 (2012) Article 12.7.7.
- Eric Weisstein's World of Mathematics, Riffle Shuffle
- Eric Weisstein's World of Mathematics, In-Shuffle
- Eric Weisstein's World of Mathematics, Out-Shuffle
- Eric Weisstein's World of Mathematics, Multiplicative Order
- Wikipedia, Riffle Shuffle
Crossrefs
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
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
Extensions
More terms from David W. Wilson, Jan 13 2000
More terms from Benoit Cloitre, Apr 11 2003
Comments