Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I M4363 N1828 #203 Apr 06 2024 20:31:02
%S 7,19,37,61,127,271,331,397,547,631,919,1657,1801,1951,2269,2437,2791,
%T 3169,3571,4219,4447,5167,5419,6211,7057,7351,8269,9241,10267,11719,
%U 12097,13267,13669,16651,19441,19927,22447,23497,24571,25117,26227,27361,33391
%N Cuban primes: primes which are the difference of two consecutive cubes.
%C Primes of the form p = (x^3 - y^3)/(x - y) where x=y+1. See A007645 for generalization. I first saw the name "cuban prime" in Cunningham (1923). Values of x are in A002504 and y are in A111251. - _N. J. A. Sloane_, Jan 29 2013
%C Prime hex numbers (cf. A003215).
%C Equivalently, primes of the form p=1+3k(k+1) (and then k=floor(sqrt(p/3))). Also: primes p such that n^2(p+n) is a cube for some n>0. - _M. F. Hasler_, Nov 28 2007
%C Primes p such that 4p = 1+3s^2 for some integer s (A121259). - _Michael Somos_, Sep 15 2005
%C This sequence is believed to be infinite. - _N. J. A. Sloane_, May 07 2020
%D Allan Joseph Champneys Cunningham, On quasi-Mersennian numbers, Mess. Math., 41 (1912), 119-146.
%D Allan Joseph Champneys Cunningham, Binomial Factorisations, Vols. 1-9, Hodgson, London, 1923-1929; see Vol. 1, pp. 245-259.
%D J.-M. De Koninck & A. Mercier, 1001 Problèmes en Théorie Classique des Nombres, Problem 241 pp. 39; 179, Ellipses Paris 2004.
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H David A. Corneth, <a href="/A002407/b002407.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)
%H A. J. C. Cunningham, <a href="/A002407/a002407.pdf">On quasi-Mersennian numbers</a>, Mess. Math., 41 (1912), 119-146. [Annotated scan of page 144 only]
%H A. J. C. Cunningham, <a href="/A001912/a001912.pdf">Binomial Factorisations</a>, Vols. 1-9, Hodgson, London, 1923-1929. [Annotated scans of a few pages from Volumes 1 and 2]
%H R. K. Guy, <a href="/A005728/a005728.pdf">Letter to N. J. A. Sloane, 1987</a>.
%H G. L. Honaker, Jr., <a href="https://t5k.org/curios/page.php?curio_id=22949">Prime curio for 127</a>.
%H Michael Penn, <a href="https://www.youtube.com/watch?v=3F49x2R9Bno">Nearly cubic primes.</a>, YouTube video, 2023.
%H Project Euler, <a href="https://projecteuler.net/problem=131">Problem 131: Prime cube partnership</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/CubanPrime.html">Cuban Prime</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Cuban_prime">Cuban prime</a>.
%F a(n) = 6*A000217(A111251(n)) + 1. - _Christopher Hohl_, Jul 01 2019
%F From _Rémi Guillaume_, Nov 07 2023: (Start)
%F a(n) = A003215(A111251(n)).
%F a(n) = (3*(2*A002504(n) - 1)^2 + 1)/4.
%F a(n) = (3*A121259(n)^2 + 1)/4.
%F a(n) = prime(A145203(n)). (End)
%e a(1) = 7 = 1+3k(k+1) (with k=1) is the smallest prime of this form.
%e a(10^5) = 1792617147127 since this is the 100000th prime of this form.
%t lst={}; Do[If[PrimeQ[p=(n+1)^3-n^3], AppendTo[lst, p]], {n, 10^2}]; lst (* _Vladimir Joseph Stephan Orlovsky_, Aug 21 2008 *)
%t Select[Table[3x^2+3x+1,{x,100}],PrimeQ] (* or *) Select[Last[#]- First[#]&/@ Partition[Range[100]^3,2,1],PrimeQ] (* _Harvey P. Dale_, Mar 10 2012 *)
%t Select[Differences[Range[100]^3],PrimeQ] (* _Harvey P. Dale_, Jan 19 2020 *)
%o (PARI) {a(n)= local(m, c); if(n<1, 0, c=0; m=1; while( c<n, m++; if( isprime(m) && issquare((4*m-1)/3), c++)); m)} /* _Michael Somos_, Sep 15 2005 */
%o (PARI)
%o A002407(n,k=1)=until(isprime(3*k*k+++1) && !n--,);3*k*k--+1
%o list_A2407(Nmax)=for(k=1,sqrt(Nmax/3),isprime(t=3*k*(k+1)+1) && print1(t",")) \\ _M. F. Hasler_, Nov 28 2007
%o (Magma) [a: n in [0..100] | IsPrime(a) where a is (3*n^2+3*n+1)]; // _Vincenzo Librandi_, Jan 20 2020
%o (Python)
%o from sympy import isprime
%o def aupto(limit):
%o alst, k, d = [], 1, 7
%o while d <= limit:
%o if isprime(d): alst.append(d)
%o k += 1; d = 1+3*k*(k+1)
%o return alst
%o print(aupto(34000)) # _Michael S. Branicky_, Jul 19 2021
%Y Cf. A000217, A002504, A003215, A111251, A113478, A145203.
%Y Cf. A002648 (with x=y+2), A003627, A007645, A201477, A334520.
%K nonn,easy,nice
%O 1,1
%A _N. J. A. Sloane_
%E More terms from _James A. Sellers_, Aug 08 2000
%E Entry revised by _N. J. A. Sloane_, Jan 29 2013