%I #20 Sep 03 2024 15:02:30
%S 1,2,3,3,4,4,5,4,6,6,6,7,7,7,8,7,8,9,9,9,9,8,10,9,10,11,11,11,11,12,
%T 12,12,11,12,11,12,13,13,13,14,14,14,13,14,14,14,15,14,14,12,14,15,14,
%U 15,16,17,17,16,16,16,16,17,16,16,17,17,16,16,15,17,19
%N Let S be the sequence of integer sets defined by these rules: S(1) = {1}, and for any n > 1, S(n) = {n} U S(pi(n)) U S(n - pi(n)) (where X U Y denotes the union of the sets X and Y and pi is the prime counting function); a(n) = the number of elements of S(n).
%C The prime counting function corresponds to A000720.
%C This sequence has similarities with A294991; a(n) gives approximately the number of intermediate terms to consider in order to compute A316434(n) using the formula of its definition.
%H Rémy Sigrist, <a href="/A321211/b321211.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A321211/a321211_1.png">Illustration of a(42)</a>
%H Rémy Sigrist, <a href="/A321211/a321211.png">Density plot of the first 100000000 terms</a>
%H Rémy Sigrist, <a href="/A321211/a321211.txt">C++ program for A321211</a>
%e The first terms, alongside pi(n) and S(n), are:
%e n a(n) pi(n) S(n)
%e -- ---- ----- ----------------------
%e 1 1 0 {1}
%e 2 2 1 {1, 2}
%e 3 3 2 {1, 2, 3}
%e 4 3 2 {1, 2, 4}
%e 5 4 3 {1, 2, 3, 5}
%e 6 4 3 {1, 2, 3, 6}
%e 7 5 4 {1, 2, 3, 4, 7}
%e 8 4 4 {1, 2, 4, 8}
%e 9 6 4 {1, 2, 3, 4, 5, 9}
%e 10 6 4 {1, 2, 3, 4, 6, 10}
%e 11 6 5 {1, 2, 3, 5, 6, 11}
%e 12 7 5 {1, 2, 3, 4, 5, 7, 12}
%o (C++) // See Links section.
%o (PARI) a(n) = my (v=Set([-1, -n]), i=1); while (v[i]!=-1, my (pi=primepi(-v[i])); v=setunion(v, Set([v[i]+pi, -pi])); i++); #v
%Y Cf. A000720, A294991, A316434.
%K nonn
%O 1,2
%A _Altug Alkan_ and _Rémy Sigrist_, Oct 31 2018