A295235 Numbers k such that the positions of the ones in the binary representation of k are in arithmetic progression.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 21, 24, 28, 30, 31, 32, 33, 34, 36, 40, 42, 48, 56, 60, 62, 63, 64, 65, 66, 68, 72, 73, 80, 84, 85, 96, 112, 120, 124, 126, 127, 128, 129, 130, 132, 136, 144, 146, 160, 168, 170, 192, 224, 240, 248
Offset: 1
Examples
The binary representation of the number 42 is "101010" and has ones evenly spaced, hence 42 appears in the sequence. The first terms, alongside their binary representations, are: n a(n) a(n) in binary -- ---- -------------- 1 0 0 2 1 1 3 2 10 4 3 11 5 4 100 6 5 101 7 6 110 8 7 111 9 8 1000 10 9 1001 11 10 1010 12 12 1100 13 14 1110 14 15 1111 15 16 10000 16 17 10001 17 18 10010 18 20 10100 19 21 10101 20 24 11000
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..1000
Crossrefs
Programs
-
Maple
f:= proc(d) local i,j,k; op(sort([seq(seq(add(2^(d-j*k),k=0..m),m=1..d/j),j=1..d),2^(d+1)])) end proc: 0,1,seq(f(d),d=0..10); # Robert Israel, Nov 20 2017
-
Mathematica
bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1]; Select[Range[100],SameQ@@Differences[bpe[#]]&] (* Gus Wiseman, Jul 22 2019 *)
-
PARI
is(n) = my(h=hammingweight(n)); if(h<3, return(1), my(i=valuation(n,2),w=#binary(n)); if((w-i-1)%(h-1)==0, my(j=(w-i-1)/(h-1)); return(sum(k=0,h-1,2^(i+j*k))==n), return(0)))
Comments