OFFSET
1,3
COMMENTS
Notice that a(n) is divisible by n.
a(n)=0 for any n of the form 2^i.
FORMULA
a(n) = Sum_{i=x..x+P-1} (2^i mod n) having: P=Period of binary representation of 1/n; x large enough for the period to start.
EXAMPLE
a(1)=0 because 2^i mod 1 = {0,0,0,0,0,0,0,0,0...} and p=1;
a(2)=0 because 2^i mod 2 = {1,0,0,0,0,0,0,0,0...}, p=1, x>1;
a(14)=14 because 2^i mod 14 = {1,2,4,8,2,4,8,2,4,8,...}, p=3, x>1 ---> a=2+4+8=14;
a(35)=175 because 2^i mod 35 = {1,2,4,8,16,32,29,23,11,22,9,18,1,2,4,...}, p=12, x>0 ---> a = 1+2+4+8+16+32+29+23+11+22+9+18 = 175.
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Néstor Romeral Andrés, Aug 02 2006
STATUS
approved