%I #24 Jun 30 2022 14:43:26
%S 0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
%T 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
%N Characteristic function of A001317.
%C a(k) = 1 iff k is in A001317, and 0 for all other values.
%C The recursive formula is based on the fact that only from the terms of A001317 we can reach all the way down to 1 when repeatedly applying the map k -> A006068(k)/2 as long as it is possible to iterate (before A006068(k) is odd).
%C This sequence is not multiplicative. The smallest counterexample is for n = A000215(6) = 4294967297 which is the first composite Fermat number. In this case a(n) = 1 which is not the product of a(641) and a(6700417) which are both zero. - _Andrew Howroyd_, Aug 08 2018
%H Antti Karttunen, <a href="/A268384/b268384.txt">Table of n, a(n) for n = 0..4369</a>
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F a(0) = 0, a(1) = 1, and for n > 1, a(n) = 0 if A006068(n) is odd, otherwise a(A006068(n)/2).
%F a(n) = A209229(A193231(n)).
%o (Scheme, two variants)
%o (definec (A268384 n) (cond ((<= n 1) n) ((odd? (A006068 n)) 0) (else (A268384 (/ (A006068 n) 2))))) ;; Uses the memoization-macro definec
%o (define (A268384 n) (A209229 (A193231 n)))
%o (Python)
%o from itertools import count, islice
%o def A268384_gen(): # generator of terms
%o a = -1
%o for n in count(0):
%o b = int(''.join(str(int(not(~n&k))) for k in range(n+1)), 2)
%o yield from (0,)*(b-a-1)
%o yield 1
%o a = b
%o A268384_list = list(islice(A268384_gen(),30)) # _Chai Wah Wu_, Jun 30 2022
%Y Cf. A001317, A006068, A193231, A209229.
%Y Cf. also A000215, A268389, A268391.
%K nonn
%O 0
%A _Antti Karttunen_, Feb 10 2016