OFFSET
1,1
COMMENTS
For n >= 3, a(n) is a multiple of 18.
I conjecture that there are infinitely many prime numbers with each of the digital roots from the set {1,2,4,5,7,8}. This would imply that the only prime number with a(n) = 0 is 3.
The conjecture is true; for any d in {1,2,4,5,7,8}, gcd(d, 9) = 1, hence, according to Dirichlet's theorem on arithmetic progressions, there are infinitely many primes of the form d + 9*k, and these primes all have digital root d. - Rémy Sigrist, Mar 25 2018
EXAMPLE
For n=1, prime(n) = 2; 2 mod 9 = 2. The next prime that has the same digital root is 11, because 11 mod 9 = 2. So 11 - 2 = 9 is the first term.
MATHEMATICA
Table[With[{p = Prime@ n}, If[IntegerQ@ #, # - p, 0] &@ SelectFirst[Prime@ Range[n + 1, n + 120], SameQ @@ Mod[{#, p}, 9] &]], {n, 60}] (* Michael De Vlieger, Feb 10 2018 *)
PROG
(PARI) {
print1(9", "0", ");
forprime(n=5, 1000,
p=n%9; i=nextprime(n+1);
while((i%9)<>p, i=nextprime(i+1));
print1(i-n", ")
)
}
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Dimitris Valianatos, Feb 03 2018
STATUS
approved