OFFSET
1,3
LINKS
Mikhail Kurkov, Table of n, a(n) for n = 1..13495
FORMULA
Conjecture: a(n) - a(n-1) belongs to A094373. - Mikhail Kurkov, Feb 20 2021
MATHEMATICA
a[n_?EvenQ] := a[n] = -a[n/2]; a[0] = 0; a[n_] := a[n] = a[(n - 1)/2] + 1; -1 + Position[Table[Product[ 1 + a[Floor[n/(2^k)]], {k, 0, Floor[Log2[n]]}], {n, 0, 500}], _?(# != 0 &)][[All, 1]] (* Michael De Vlieger, Apr 22 2024, after Jean-François Alcover at A004718 *)
PROG
(PARI) b(n) = if(n==0, 0, (-1)^(n+1)*b(n\2) + n%2); \\ A004718
f(n) = if(n==0, 1, prod(k=0, logint(n, 2), 1+b(n\2^k)));
isok(n) = f(n)!=0; \\ Michel Marcus, May 24 2019
(Python)
from itertools import count, islice
def A325804_gen(startvalue=0): # generator of terms >= startvalue
for n in count(max(startvalue, 0)):
c, s = [0]*(m:=n.bit_length()), bin(n)[2:]
for i in range(m):
if s[i]=='1':
for j in range(m-i):
c[j] = c[j]+1
else:
for j in range(m-i):
c[j] = -c[j]
if all(1+d for d in c): yield n
CROSSREFS
KEYWORD
nonn
AUTHOR
Mikhail Kurkov, May 22 2019
STATUS
approved