OFFSET
1,2
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0,0,17,0,0,-16).
FORMULA
From Colin Barker, May 19 2016: (Start)
a(n) = 17*a(n-3) - 16*a(n-6) for n>6.
G.f.: x*(1+2*x+6*x^2+2*x^3+4*x^4) / ((1-x)*(1+x+x^2)*(1-16*x^3)).
(End)
MATHEMATICA
Select[Range[10^6], IntegerQ@ Log2[FromDigits[RotateRight@ #, 2] + FromDigits[RotateLeft@ #, 2]] &@ IntegerDigits[#, 2] &] (* or *)
Rest@ CoefficientList[Series[x (1 + 2 x + 6 x^2 + 2 x^3 + 4 x^4)/((1 - x) (1 + x + x^2) (1 - 16 x^3)), {x, 0, 30}], x] (* Michael De Vlieger, May 19 2016 *)
PROG
(C)
#include <stdio.h>
int main(int argc, char** argv)
{
unsigned long long x, n, BL=0;
for (n=1; n>0; ++n) {
if ((n & (n-1))==0) ++BL;
x = (n>>1) + ((n&1) << (BL-1)); // A038572(n)
x+= (n*2) - (1ull<<BL) + 1; // A006257(n) for n>0
if ((x & (x-1))==0) printf("%lld, ", n);
}
}
(PARI) Vec(x*(1+2*x+6*x^2+2*x^3+4*x^4)/((1-x)*(1+x+x^2)*(1-16*x^3)) + O(x^50)) \\ Colin Barker, May 19 2016
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Alex Ratushnyak, May 17 2016
STATUS
approved