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.

This page as a plain text file.
%I A181758 #14 May 25 2021 10:31:02
%S A181758 2,7,29,67,127,211,347,509,727,997,1327,1733,2203,2741,3373,4099,4909,
%T A181758 5827,6857,7993,9257,10651,12163,13829,15629,17579,19681,21961,24391,
%U A181758 26993,29789,32771,35933,39301,42863,46663,50651,54869,59333,63997,68917,74093,79493,85193,91127,97327,103813,110597,117643,125003
%N A181758 Greatest prime closest to n^3.
%H A181758 David A. Corneth, <a href="/A181758/b181758.txt">Table of n, a(n) for n = 1..10000</a>
%e A181758 29 is the greatest prime closest to 3^3 = 27.
%t A181758 f3[n_]:=Module[{n3=n^3,np1,np2},np1=NextPrime[n3,-1];np2=NextPrime[n3];If[(n3-np1)<(np2-n3),np1,np2]];
%t A181758 Table[f3[i],{i,50}]
%o A181758 (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
%Y A181758 Cf. A113426.
%K A181758 nonn
%O A181758 1,1
%A A181758 _Harvey P. Dale_