%I #33 Jul 23 2019 00:43:34
%S 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,
%T 36,40,42,48,56,60,62,63,64,65,66,68,72,73,80,84,85,96,112,120,124,
%U 126,127,128,129,130,132,136,144,146,160,168,170,192,224,240,248
%N Numbers k such that the positions of the ones in the binary representation of k are in arithmetic progression.
%C Also numbers k of the form Sum_{b=0..h-1} 2^(i+j*b) for some h >= 0, i >= 0, j > 0 (in fact, h = A000120(k), and if k > 0, i = A007814(k)).
%C There is a simple bijection between the finite sets of nonnegative integers in arithmetic progression and the terms of this sequence: s -> Sum_{i in s} 2^i; the term 0 corresponds to the empty set.
%C For any n > 0, A054519(n) gives the numbers of terms with n+1 digits in binary representation.
%C For any n >= 0, n is in the sequence iff 2*n is in the sequence.
%C For any n > 0, A000695(a(n)) is in the sequence.
%C The first prime numbers in the sequence are: 2, 3, 5, 7, 17, 31, 73, 127, 257, 8191, 65537, 131071, 262657, 524287, ...
%C This sequence contains the following sequences: A000051, A000079, A000225, A000668, A002450, A019434, A023001, A048645.
%C For any k > 0, 2^k - 2, 2^k - 1, 2^k, 2^k + 1 and 2^k + 2 are in the sequence (e.g., 14, 15, 16, 17, and 18).
%C Every odd term is a binary palindrome (and thus belongs to A006995).
%C Odd terms are A064896. - _Robert Israel_, Nov 20 2017
%H Rémy Sigrist, <a href="/A295235/b295235.txt">Table of n, a(n) for n = 1..1000</a>
%e The binary representation of the number 42 is "101010" and has ones evenly spaced, hence 42 appears in the sequence.
%e The first terms, alongside their binary representations, are:
%e n a(n) a(n) in binary
%e -- ---- --------------
%e 1 0 0
%e 2 1 1
%e 3 2 10
%e 4 3 11
%e 5 4 100
%e 6 5 101
%e 7 6 110
%e 8 7 111
%e 9 8 1000
%e 10 9 1001
%e 11 10 1010
%e 12 12 1100
%e 13 14 1110
%e 14 15 1111
%e 15 16 10000
%e 16 17 10001
%e 17 18 10010
%e 18 20 10100
%e 19 21 10101
%e 20 24 11000
%p f:= proc(d) local i,j,k;
%p op(sort([seq(seq(add(2^(d-j*k),k=0..m),m=1..d/j),j=1..d),2^(d+1)]))
%p end proc:
%p 0,1,seq(f(d),d=0..10); # _Robert Israel_, Nov 20 2017
%t bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
%t Select[Range[100],SameQ@@Differences[bpe[#]]&] (* _Gus Wiseman_, Jul 22 2019 *)
%o (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)))
%Y Cf. A000051, A000079, A000120, A000225, A000668, A000695, A002450, A006995, A007814, A019434, A023001, A048645, A054519, A064896.
%Y Cf. A029931, A048793 (binary indices triangle), A070939, A291166, A325328 (prime indices rather than binary indices), A326669, A326675.
%K nonn,base
%O 1,3
%A _Rémy Sigrist_, Nov 18 2017