OFFSET
1,2
COMMENTS
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Rémy Sigrist, Illustration of a(42)
Rémy Sigrist, Density plot of the first 100000000 terms
Rémy Sigrist, C++ program for A321211
EXAMPLE
The first terms, alongside pi(n) and S(n), are:
n a(n) pi(n) S(n)
-- ---- ----- ----------------------
1 1 0 {1}
2 2 1 {1, 2}
3 3 2 {1, 2, 3}
4 3 2 {1, 2, 4}
5 4 3 {1, 2, 3, 5}
6 4 3 {1, 2, 3, 6}
7 5 4 {1, 2, 3, 4, 7}
8 4 4 {1, 2, 4, 8}
9 6 4 {1, 2, 3, 4, 5, 9}
10 6 4 {1, 2, 3, 4, 6, 10}
11 6 5 {1, 2, 3, 5, 6, 11}
12 7 5 {1, 2, 3, 4, 5, 7, 12}
PROG
(C++) // See Links section.
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Altug Alkan and Rémy Sigrist, Oct 31 2018
STATUS
approved