%I #27 Oct 07 2024 15:28:20
%S 2,1,3,1,1,3,2,0,2,2,2,1,2,1,3,1,2,0,4,0,2,2,1,2,0,2,2,1,3,1,2,1,2,3,
%T 0,1,2,2,1,1,2,1,2,0,3,1,2,1,2,0,4,1,2,3,2,0,2,1,2,0,2,1,0,2,0,3,3,0,
%U 4,1,2,0,2,1,3,2,0,0,3,1,0,3,2,3,0,1,3
%N The number of times n occurs in A095972.
%C Alternative definition: a(n) = number of k such that A000224(k) = k - n.
%H T. D. Noe, <a href="/A218578/b218578.txt">Table of n, a(n) for n = 0..10000</a>
%e a(0) is 2, because 0 occurs only twice in A095972. a(1) is 1, because 1 occurs only once in A095972.
%p A218578 := proc(n)
%p local f;
%p f := 0 ;
%p for q from 1 to 2*n+2 do
%p if A095972(q) = n then
%p f := f+1 ;
%p end if;
%p end do:
%p f ;
%p end proc: # _R. J. Mathar_, Nov 05 2012
%t nn = 100; t = Table[Length[Complement[Range[n-1], Union[Mod[Range[n]^2, n]]]], {n, 2*nn + 2}]; Table[Count[t, n], {n, 0, nn}] (* _T. D. Noe_, Nov 06 2012 *)
%o (Python)
%o from math import prod
%o from factorint import factorint
%o def A218578(n): return sum(1 for i in range(1,2*n+3) if n==i-prod((p**(e+1)//((p+1)*(q:=1+(p==2)))>>1)+q for p, e in factorint(i).items())) # _Chai Wah Wu_, Oct 07 2024
%Y Cf. A000224, A095972, A218620 (greedy inverse).
%K nonn
%O 0,1
%A _Dmitri Kamenetsky_, Nov 03 2012