A014664 Order of 2 modulo the n-th prime.
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
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.
Links
- Michael De Vlieger, Table of n, a(n) for n = 2..10001 (terms 2..1001 from Nick Hobson, terms 1002..5001 from Zak Seidov)
- Gary W. Adamson, Further comments.
- O. N. Karpenkov, On examples of difference operators for {0,1}-valued functions over finite sets, Funct. Anal. Other Math. 1 (2006), 175-180.
- O. N. Karpenkov, On examples of difference operators for {0,1}-valued functions over finite sets, arXiv:math/0611940 [math.CO], 2006.
Crossrefs
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
Extensions
More terms from Benoit Cloitre, Apr 11 2003
Comments