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