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!)
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
Sequence in context: A229297 A116675 A123022 * A072175 A280712 A363926
KEYWORD
sign
AUTHOR
Joseph L. Pe, Aug 14 2002
STATUS
approved

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 March 19 02:49 EDT 2024. Contains 370952 sequences. (Running on oeis4.)