[go: up one dir, main page]

login
Smallest prime p with property that the sum of the n-th power of the successive gaps between primes <= p is also a prime number.
2

%I #34 Mar 02 2019 02:00:39

%S 5,5,7,5,43,13,7,5,241,13,43,41,19,41,7,5,13,83,43,229,811,41,31,167,

%T 811,127,367,419,79,43,43,83,673,19,109,83,13,331,523,409,199

%N Smallest prime p with property that the sum of the n-th power of the successive gaps between primes <= p is also a prime number.

%C First appearance of p, by power, beginning with 5: 1, 3, ??, 6, ??, 13, ??, 86, 23, ??, 12, 5, ... . - _Robert G. Wilson v_, Jan 11 2015

%H Robert G. Wilson v, <a href="/A252655/b252655.txt">Table of n, a(n) for n = 1..1000</a> (first 100 terms from Abhiram R Devesh)

%e n=1: p=5; primes less than or equal to 5: [2, 3, 5]; prime gaps: [1, 2]; sum of prime gaps: 3.

%e n=2: p=5; primes less than or equal to 5: [2, 3, 5]; squares of prime gaps: [1, 4]; sum of squares of prime gaps: 5.

%e n=3: p=7; primes less than or equal to 7: [2, 3, 5, 7]; cubes of prime gaps: [1, 8, 8]; sum of cubes of prime gaps: 17.

%e n=4: p=5; primes less than or equal to 5: [2, 3, 5]; 4th power of prime gaps: [1, 16]; sum of 4th power of prime gaps: 17.

%t f[n_] := Block[{p = 2, s = 0}, While[ !PrimeQ@ s, q = NextPrime@ p; s = s + (q - p)^n; p = q]; p]; Array[f, 60] (* _Robert G. Wilson v_, Jan 11 2015 *)

%o (Python)

%o import sympy

%o c=1

%o while c>0:

%o ....p=2

%o ....d=0

%o ....s=0

%o ....while p>0:

%o ........s=s+(d**c)

%o ........sp=sympy.isprime(s)

%o ........if sp ==True:

%o ............print(c,p)

%o ............p=-1

%o ............c=c+1

%o ........else:

%o ............np=sympy.nextprime(p)

%o ............d=np-p

%o ............p=np

%Y Cf. A006512, A247177, A247178, A251623.

%K nonn

%O 1,1

%A _Abhiram R Devesh_, Dec 19 2014