login
Numbers n such that the sum of two consecutive primes prime(n+1) + prime(n) is a prime power, say q^w. The w values are in A071087.
2

%I #18 Apr 30 2017 10:21:28

%S 1,2,18,564,1462626667154509638735

%N Numbers n such that the sum of two consecutive primes prime(n+1) + prime(n) is a prime power, say q^w. The w values are in A071087.

%F For n>1, a(n) = A007053(A071087(n)-1). - _Max Alekseyev_, Jul 27 2009

%e n=1: p(2)+p(1) = 3+2 = 5^1

%e n=2: p(3)+p(2) = 5+3 = 2^3

%e n=18: p(19)+p(18) = 61+67 = 2^7

%e n=564: p(565)+p(564) = 4099+4093 = 2^13

%t Do[s=Prime[n+1]+Prime[n]; If[Equal[Length[FactorInteger[s]], 1], Print[{n, Prime[n], s}]], {n, 1, 10000000}]

%t p = q = 2; NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; Do[q = NextPrim[p]; If[ Length[ Flatten[ Table[ #[[1]], {1}] & /@ FactorInteger[p + q]]] == 1, Print[n]]; p = q, {n, 1, 10^7}] (* _Robert G. Wilson v_, Jan 24 2004 *)

%Y Cf. A071087, A091624.

%K nonn,more,hard

%O 1,2

%A _Labos Elemer_, May 21 2002

%E a(5) added by _Max Alekseyev_, Feb 10 2011