%I #10 Mar 31 2019 03:42:00
%S 17,1,2,2,2,2,8,2,40,2,2,4,2,2,8,4,4,2,2,6,2,4,38,4,2,4,4,10,4,2,2,6,
%T 12,8,4,2,4,38,10,8,2,4,2,2,4,2,2,2,12,2,6,2,2,4,20,8,4,2,2,2,4,2,2,8,
%U 4,2,12,2,8,2,4,16,2,2,2,22,8,2,2,2,2,4,2
%N Starting from any prime p_i (with i = 1, 2, 3 …) sequence lists the minimum number of consecutive primes that must be added minus 1 to reach another prime.
%C 257 is the minimum prime that can be reached in two ways: adding 4 consecutive primes starting from 59 or 2 starting from 127 and deleting 1.
%C Other primes reachable in two ways: 389, 479, 491, 761, 863, 1319, 1847, 2131, 3037, 3299, etc.
%C 239 is the minimum prime that can be reached in three ways: adding 8 consecutive primes starting from 17, 4 starting from 53 or 2 starting from 113 and deleting 1.
%C Other primes reachable in three ways: 24083, 32369, 34259, 40709, 49547, 51997, 60527, 66883, 69959, 75767, etc.
%H Paolo P. Lava, <a href="/A239866/b239866.txt">Table of n, a(n) for n = 1..1000</a>
%e a(1) = 17 because p_1 = 2 and we need to add other 16 consecutive primes minus 1 to reach another prime: 2 + 3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 + 59 - 1 = 439.
%e a(2) = 1 because p_2 = 3 and 3 - 1 = 2 is prime.
%e a(3) = 2 because p_3 = 5 and 5 + 7 - 1 = 11 is prime. Etc.
%p P:=proc(q) local a,b,c,d,n;
%p for n from 1 to q do a:=1; b:=ithprime(n); c:=b; d:=b-1;
%p while not isprime(d) do a:=a+1; c:=nextprime(c); d:=d+c; od;
%p print(a); od; end: P(10^4);
%t a[n_] := Module[{s = -1, k = 0, p = Prime[n]}, While[!PrimeQ[s], s += p; p = NextPrime[p]; k++]; k]; Array[a, 100] (* _Amiram Eldar_, Mar 31 2019 *)
%Y Cf. A000040, A239864, A239865, A239867.
%K nonn
%O 1,1
%A _Paolo P. Lava_, Mar 28 2014
|