OFFSET
1,1
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..1000
EXAMPLE
MAPLE
count:= 0:
for x from 3 while count < 30 do
y:= x^3;
r:= floor(y/3);
p0:= prevprime(r); p1:= nextprime(p0); p2:= nextprime(p1);
while p0 + p1 + p2 > y do
p2:= p1;
p1:= p0;
p0:= prevprime(p0);
od:
while p0 + p1 + p2 < y do
p0:= p1;
p1:= p2;
p2:= nextprime(p2);
od:
if p0 + p1 + p2 = y then
count:= count+1;
A[count]:= numtheory:-pi(p0);
fi
od:
seq(A[i], i=1..count); # Robert Israel, Feb 10 2017
PROG
(Python)
from __future__ import division
from sympy import prevprime, nextprime, isprime, primepi
A158796_list, i = [], 3
while i < 10**6:
n = i**3
m = n//3
pm, nm = prevprime(m), nextprime(m)
k = n - pm - nm
if isprime(m):
if m == k:
A158796_list.append(primepi(pm))
else:
if nextprime(nm) == k:
A158796_list.append(primepi(pm))
elif prevprime(pm) == k:
A158796_list.append(primepi(pm)-1)
i += 1 # Chai Wah Wu, Jun 01 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Nov 12 2009
STATUS
approved