login
A277129
Largest m < n such that 2^m == 2^n (mod n).
0
0, 1, 1, 3, 1, 4, 4, 7, 3, 6, 1, 10, 1, 11, 11, 15, 9, 12, 1, 16, 15, 12, 12, 22, 5, 14, 9, 25, 1, 26, 26, 31, 23, 26, 23, 30, 1, 20, 27, 36, 21, 36, 29, 34, 33, 35, 24, 46, 28, 30, 43, 40, 1, 36, 35, 53, 39, 30, 1, 56, 1, 57, 57, 63, 53, 56, 1, 60, 47, 58, 36, 66, 64, 38, 55, 58, 47, 66, 40, 76, 27, 62, 1
OFFSET
1,4
COMMENTS
If n is odd, then a(n) = n - A002326((n-1)/2).
MATHEMATICA
Table[m = n - 1; While[Mod[2^m, n] != Mod[2^n, n], m--]; m, {n, 83}] (* Michael De Vlieger, Oct 02 2016 *)
PROG
(PARI) a(n) = {if(n==0, return(0)); my(pt = valuation(n, 2), odd = n/2^pt, ul = odd-A002326(odd\2)); forstep(i = n-1, ul, -1, if(Mod(2, n)^i==Mod(2, n)^n, return(i)))} \\ David A. Corneth, Oct 01 2016
A002326(n)=if(n<0, 0, znorder(Mod(2, 2*n+1)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Oct 01 2016
EXTENSIONS
More terms from Altug Alkan, Oct 01 2016
STATUS
approved