OFFSET
1,1
MATHEMATICA
Differences @ Join[{1}, Select[Range[2, 1000], IntegerExponent[#, 2] == Floor[Log2[# - 1]] - DigitCount[# - 1, 2, 1] &]] (* Amiram Eldar, Sep 21 2022 *)
PROG
(PARI) isok(k) = if (k==1, 1, (logint(k-1, 2)-hammingweight(k-1) == valuation(k, 2))); \\ A353654
lista(nn) = my(v=select(isok, [1..nn])); vector(#v-1, k, v[k+1] - v[k]); \\ Michel Marcus, Sep 21 2022
(Python 3.10+)
from itertools import pairwise, count, islice
def A356385_gen(): # generator of terms
return map(lambda x:x[1]-x[0], pairwise(filter(lambda n:(~n & n-1).bit_length()<<1 == n.bit_length()-n.bit_count(), count(1))))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Mikhail Kurkov, Aug 05 2022
STATUS
approved