OFFSET
1,1
COMMENTS
Given a shift register : r(k)=r(k-1)+ X if r(k-1) is not divisible Y, else r(k)=r(k-1)/Y.
Gcd(r(0), X))=1, Gcd(X, Y)=1.
Then the length of the period orbit of such a register is L + digitsum (r(L)*(Y^L-1)/ X). Digitsum(z)in base X.
r(L) a point from period orbit, L minimal possible exponent such that (Y^L-1)/X)is a positive integer.
Number of period orbits is the order of the cyclic group connected to the register.
a(n) is the period length for Y=2, X=2*n-1, r(L)=1. [Ctibor O. Zizka, Nov 24 2009]
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = L + digitsum((2^L -1)/(2*n-1)). Digitsum(z)in base 2. [Ctibor O. Zizka, Nov 24 2009]
EXAMPLE
n=1, a(1)=1 + digitsum(1)= 2.
n=2, a(2)=2 + digitsum(1)=3.
n=3, a(3)= 4 + digitsum(3) = 6.
n=4, a(4)= 3 + digitsum(1)=4.
n=5, a(5)= 6 + digitsum(7)=9. [Ctibor O. Zizka, Nov 24 2009]
MAPLE
MATHEMATICA
Table[(b = MultiplicativeOrder[2, 2 n - 1]) + Plus @@ IntegerDigits[(2^b - 1)/(2 n - 1), 2], {n, 1, 70}] (* Ivan Neretin, May 09 2015 *)
PROG
(PARI) hamming(n)=my(v=binary(n)); sum(i=1, #v, v[i])
a(n)=my(x=2*n+1, m=znorder(Mod(2, x))); m+hamming((1<<m)\x)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Ctibor O. Zizka, Sep 26 2009
EXTENSIONS
Program and extension by Charles R Greathouse IV, Nov 24 2009
Definition corrected and comments merged by R. J. Mathar, Nov 26 2009
STATUS
approved