login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A158796 Index of first of three successive primes which sum to a cube. 3

%I #12 Jun 01 2017 10:18:50

%S 85,3696,79700,263166,283353,434935,678277,950264,1043678,1266169,

%T 1321463,1436753,2629623,3568796,3604676,3676738,3713180,5096401,

%U 5558697,7162624,9303565,9504536,10988577,12778681,13108392,18730119

%N Index of first of three successive primes which sum to a cube.

%H Chai Wah Wu, <a href="/A158796/b158796.txt">Table of n, a(n) for n = 1..1000</a>

%e a(1)=85 because prime(85)+prime(86)+prime(87)=439+443+449=11^3=(A076306(1))^3

%e a(2)=3696 because prime(3696)+prime(3697)+prime(3698)=34603+34607+34613=47^3=(A076306(2))^3.

%p count:= 0:

%p for x from 3 while count < 30 do

%p y:= x^3;

%p r:= floor(y/3);

%p p0:= prevprime(r); p1:= nextprime(p0); p2:= nextprime(p1);

%p while p0 + p1 + p2 > y do

%p p2:= p1;

%p p1:= p0;

%p p0:= prevprime(p0);

%p od:

%p while p0 + p1 + p2 < y do

%p p0:= p1;

%p p1:= p2;

%p p2:= nextprime(p2);

%p od:

%p if p0 + p1 + p2 = y then

%p count:= count+1;

%p A[count]:= numtheory:-pi(p0);

%p fi

%p od:

%p seq(A[i],i=1..count); # _Robert Israel_, Feb 10 2017

%o (Python)

%o from __future__ import division

%o from sympy import prevprime, nextprime, isprime, primepi

%o A158796_list, i = [], 3

%o while i < 10**6:

%o n = i**3

%o m = n//3

%o pm, nm = prevprime(m), nextprime(m)

%o k = n - pm - nm

%o if isprime(m):

%o if m == k:

%o A158796_list.append(primepi(pm))

%o else:

%o if nextprime(nm) == k:

%o A158796_list.append(primepi(pm))

%o elif prevprime(pm) == k:

%o A158796_list.append(primepi(pm)-1)

%o i += 1 # _Chai Wah Wu_, Jun 01 2017

%Y Cf. A076304, A076306.

%K nonn

%O 1,1

%A _Zak Seidov_, Nov 12 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 05:35 EDT 2024. Contains 371697 sequences. (Running on oeis4.)