login
A273180
Numbers n such that ror(n) + rol(n) is a power of 2, where ror(n)=A038572(n) is n rotated one binary place to the right, rol(n)=A006257(n) is n rotated one binary place to the left.
1
1, 2, 6, 19, 38, 102, 307, 614, 1638, 4915, 9830, 26214, 78643, 157286, 419430, 1258291, 2516582, 6710886, 20132659, 40265318, 107374182, 322122547, 644245094, 1717986918, 5153960755, 10307921510, 27487790694, 82463372083, 164926744166, 439804651110
OFFSET
1,2
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
KEYWORD
nonn,base,easy
AUTHOR
Alex Ratushnyak, May 17 2016
STATUS
approved