%I #23 Mar 26 2018 20:04:27
%S 9,0,18,36,18,18,36,18,18,18,36,36,18,18,36,18,54,18,36,18,36,18,18,
%T 18,54,36,36,72,18,18,36,18,36,18,18,72,36,18,72,18,18,18,36,18,36,72,
%U 18,18,36,54,18,18,36,18,36,18,90,36,36,36
%N a(n) is the distance from prime(n) to the next prime that has the same digital root, or a(n) = 0 if there is no greater prime with the same digital root.
%C For n >= 3, a(n) is a multiple of 18.
%C 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.
%C 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
%e 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.
%t 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 *)
%o (PARI) {
%o print1(9", "0", ");
%o forprime(n=5,1000,
%o p=n%9;i=nextprime(n+1);
%o while((i%9)<>p,i=nextprime(i+1));
%o print1(i-n", ")
%o )
%o }
%Y Cf. A038194.
%K nonn,base
%O 1,1
%A _Dimitris Valianatos_, Feb 03 2018
|