|
|
A023105
|
|
Number of distinct quadratic residues mod 2^n.
|
|
15
|
|
|
1, 2, 2, 3, 4, 7, 12, 23, 44, 87, 172, 343, 684, 1367, 2732, 5463, 10924, 21847, 43692, 87383, 174764, 349527, 699052, 1398103, 2796204, 5592407, 11184812, 22369623, 44739244, 89478487, 178956972, 357913943, 715827884, 1431655767, 2863311532
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
Number of distinct n-digit suffixes of base 2 squares.
a(n) counts the elements of A234000 smaller than 2^n plus the zero: a(7)=23 counts the elements of {0, 1, 4, 9, ..., 113, 121}, for example. - R. J. Mathar, Oct 11 2014
|
|
LINKS
|
|
|
FORMULA
|
a(n) = floor( (2^n+10)/6 ).
G.f.: (1-3*x^2-x^3)/((1-x)*(1+x)*(1-2*x)). - Colin Barker, Mar 08 2012
a(0)=1, a(1)=2. a(n) = 2*a(n-1)-2 if n is even, a(n) = 2*a(n-1)-1 if n is odd. - Vincenzo Librandi, Apr 21 2012
a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3) for n > 0. - Joerg Arndt, Apr 21 2012
E.g.f.: (exp(2*x) + 9*exp(x) - 3 - exp(-x))/6. - G. C. Greubel, Aug 10 2022
|
|
MATHEMATICA
|
CoefficientList[Series[(1-3*x^2-x^3)/((1-x)*(1+x)*(1-2*x)), {x, 0, 35}], x] (* Vincenzo Librandi, Apr 21 2012 *)
LinearRecurrence[{2, 1, -2}, {1, 2, 2, 3}, 40] (* Harvey P. Dale, Mar 05 2016 *)
|
|
PROG
|
(Haskell)
a 0 = 1
a 1 = 2
a n | even n = 2*a(n-1)-2
a n | odd n = 2*a(n-1)-1
(SageMath) [(2^n +9 -(-1)^n -3*bool(n==0))/6 for n in (0..30)] # G. C. Greubel, Aug 10 2022
(Python)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|