cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A181758 Greatest prime closest to n^3.

Original entry on oeis.org

2, 7, 29, 67, 127, 211, 347, 509, 727, 997, 1327, 1733, 2203, 2741, 3373, 4099, 4909, 5827, 6857, 7993, 9257, 10651, 12163, 13829, 15629, 17579, 19681, 21961, 24391, 26993, 29789, 32771, 35933, 39301, 42863, 46663, 50651, 54869, 59333, 63997, 68917, 74093, 79493, 85193, 91127, 97327, 103813, 110597, 117643, 125003
Offset: 1

Views

Author

Keywords

Examples

			29 is the greatest prime closest to 3^3 = 27.
		

Crossrefs

Cf. A113426.

Programs

  • Mathematica
    f3[n_]:=Module[{n3=n^3,np1,np2},np1=NextPrime[n3,-1];np2=NextPrime[n3];If[(n3-np1)<(np2-n3),np1,np2]];
    Table[f3[i],{i,50}]
  • PARI
    a(n) = {if(n == 1, return(1)); my(n3 = n^3, gp = nextprime(n^3), lp = precprime(n^3)); if(n3 - lp < gp - n3, return(lp) , return(gp) ) } \\ David A. Corneth, May 25 2021