|
|
A072943
|
|
Least nonnegative integer k such that n + k^3 is prime, or -1 if no such k exists.
|
|
1
|
|
|
1, 0, 0, 1, 0, 1, 0, -1, 2, 1, 0, 1, 0, 3, 2, 1, 0, 1, 0, 3, 2, 1, 0, 5, 4, 3, -1, 1, 0, 1, 0, 3, 2, 3, 2, 1, 0, 5, 2, 1, 0, 1, 0, 3, 2, 1, 0, 5, 4, 11, 2, 1, 0, 5, 6, 3, 8, 1, 0, 1, 0, 3, 2, -1, 2, 1, 0, 5, 10, 1, 0, 1, 0, 3, 2, 3, 6, 1, 0, 3, 2, 1, 0, 13, 4, 3, 4, 1, 0, 7, 6, 9, 2, 9, 2, 1, 0, 5, 2, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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
|
|
|
STATUS
|
approved
|
|
|
|