OFFSET
1,9
COMMENTS
For n = 2^3, 3^3, 4^3,...., a(n) = -1 since, say, 2^3 + k^3 cannot be prime for nonnegative k (it can be factored by the sum of cubes formula).
a(n) = 0 if and only if n is prime. - Iain Fox, Dec 29 2017
LINKS
Iain Fox, Table of n, a(n) for n = 1..10000
EXAMPLE
a(9) = 2 since k = 2 is the least nonnegative integer such that 9 + k^3 is prime.
MATHEMATICA
Array[Which[PrimeQ@ #, 0, And[# > 1, IntegerQ@ Power[#, 1/3]], -1, True, Block[{k = 1}, While[! PrimeQ[# + k^3], k++]; k]] &, 100] (* Michael De Vlieger, Dec 30 2017 *)
PROG
(PARI) a(n) = if(round(n^(1/3))^3 == n && n!=1, return(-1)); for(k=0, +oo, if(isprime(n + k^3), return(k))) \\ Iain Fox, Dec 29 2017
CROSSREFS
KEYWORD
sign
AUTHOR
Joseph L. Pe, Aug 14 2002
STATUS
approved