# [seqfan] A165783 Formula for period of shift register stages

c.zizka at email.cz c.zizka at email.cz
Tue Nov 24 13:54:26 CET 2009

```Joerg, Alois,

sorry for the mismatch !

I allready sent to OEIS a completed comment to the sequence including all corrections :

A165783
Given a shift register : b(n)=b(n-1)+ X if b(n-1) is not divisible Y , else b(n)=b(n-1)/Y.
Gcd(b(0),X))=1,Gcd(X,Y)=1.
Then the length of the period orbit of such a register is L = M + digitsum (b(L)*(Y^M-1)/X).
Digitsum(z) in base X.
b(L) a point from period orbit, M minimal possible exponent such that (Y^M-1)/X is a positive integer.
Number of period orbits is the order of the cyclic group connected to the register.
This sequence has Y=2, X=2*n-1, b(L)=1. [From Ctibor O. Zizka (c.zizka(AT)email.cz), Nov 24 2009]

A165783 a(n) = M + digitsum((2^M -1)/(2*n-1)). Digitsum(z)in base 2. [From Ctibor O. Zizka (c.zizka(AT)email.cz), Nov 24 2009]

A165783 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. [From Ctibor O. Zizka (c.zizka(AT)email.cz), Nov 24 2009]

Now ,hopefully, its ok.

Ctibor

> ------------ Původní zpráva ------------
> Od: Joerg Arndt <arndt at jjj.de>
> Předmět: [seqfan] Re: A165783 Formula for period of shift register stages
> Datum: 24.11.2009 12:30:50
> ----------------------------------------
> * c.zizka at email.cz <c.zizka at email.cz> [Nov 24. 2009 20:53]:
> > The correct formula :
> >
> > a(n)=n + digitsum ( (2^n-1)/(2*n-1) ) , digitsum in base 2.
> >
> > Ctibor
> >
>
> Using pari/gp:
>
> ? for(n=1,10,print((2^n-1)/(2*n-1)) )
> 1
> 1
> 7/5
> 15/7
> 31/9
> 63/11
> 127/13
> 17
> 511/17
> 1023/19
>
> What is the Hamming weight (your digitsum) of a rational?
>
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>
>
>

```