%I #7 Jan 12 2024 12:04:59
%S 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,
%T 1,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,
%U 0,1,1,0,1,0,0,0,0,0,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0
%N a(n) = A354989(A005940(1+n)).
%H Antti Karttunen, <a href="/A368699/b368699.txt">Table of n, a(n) for n = 0..16384</a>
%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>
%F a(n) = A354989(A005940(1+n)).
%o (PARI)
%o \\ Slow:
%o A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
%o A354989(n) = for(m=1, oo, if((m*(m+1))%n==0, return(gcd(n, 1+m)<gcd(n, m))));
%o A368699(n) = A354989(A005940(1+n));
%o (PARI)
%o \\ Use this if A368698 is already computed:
%o v368698 = readvec("b368698_to.txt"); \\ Prepared with gawk ' { print $2 } ' < b368698.txt > b368698_to.txt
%o A368698(n) = v368698[1+n];
%o up_to = #v368698-1;
%o A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
%o A368699(n) = { my(u=A368698(n), k=A005940(1+n)); return(gcd(k, 1+u)<gcd(k, u)); };
%Y Cf. A005940, A354989, A368698, A368700 (partial sums).
%K nonn
%O 0
%A _Antti Karttunen_, Jan 11 2024