OFFSET
1,1
COMMENTS
LINKS
EXAMPLE
For n=1, it is not a composite number, so we add a next larger primorial (A002110) to it, which is 2, and we see that 3 is also noncomposite, thus we try to add (to the original n, which is 1) the next larger primorial, which is 6, and 7 is also prime, as are also 31, 211 and 2311. Only with A002110(6), 30030 + 1 is not a prime, thus a(1) = 5.
For n=3, the next larger primorial is 6, but 3+6 = 9 is composite, thus a(3) = 0.
For n=29, which is prime, we try adding it to four successively larger primorial numbers 30, 210, 2310, 30030, until we find 510510 which gives sum 510539 which is composite, thus a(29) = 4. In primorial base (A049345), 29 is written as 421 and the successive sums tested are: 1421, 10421, 100421, 1000421 and 10000421.
For n=121, which is not prime, but 210+121 = 331 is, while 2310+121 = 2431 is not, a(121) = 1.
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Mar 11 2019
STATUS
approved