%I #15 Dec 09 2021 14:43:17
%S 1,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,
%T 0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,
%U 0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0
%N Characteristic function of ludic numbers (A003309).
%C a(A003309(n)) = 1 and a(A192607(n)) = 0.
%H Reinhard Zumkeller, <a href="/A192490/b192490.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%t a3309[nmax_] := a3309[nmax] = Module[{t = Range[2, nmax], k, r = {1}},
%t While[Length[t] > 0, k = First[t]; AppendTo[r, k];
%t t = Drop[t, {1, -1, k}]]; r];
%t ludicQ[n_, nmax_] /; 1 <= n <= nmax := MemberQ[a3309[nmax], n];
%t nmax = 100;
%t a[n_] := Boole[ludicQ[n, nmax]];
%t Array[a, nmax] (* _Jean-François Alcover_, Dec 09 2021, after _Ray Chandler_ in A003309 *)
%o (Haskell) a192490 n = a192490_list !! (n-1)
%o a192490_list = ch [1..] a003309_list where
%o ch (i:is) ls'@(l:ls) = if i == l then 1 : ch is ls else 0 : ch is ls'
%o -- _Reinhard Zumkeller_, Feb 10 2014, Jul 05 2011
%Y Cf. A192512 (partial sums).
%K nonn
%O 1
%A _Reinhard Zumkeller_, Jul 05 2011
|