login
Product of largest prime <= n and smallest prime >= n.
6

%I #29 Dec 18 2017 04:19:19

%S 1,1,4,9,15,25,35,49,77,77,77,121,143,169,221,221,221,289,323,361,437,

%T 437,437,529,667,667,667,667,667,841,899,961,1147,1147,1147,1147,1147,

%U 1369,1517,1517,1517,1681,1763,1849,2021,2021,2021,2209,2491,2491,2491

%N Product of largest prime <= n and smallest prime >= n.

%C Symmetrical about zero, a(n)=a(-n) if n>1, if negative primes are recognized. - _Robert G. Wilson v_, Feb 28 2011

%C Iff n is a prime then a(n)=n^2, otherwise a(n) is a semiprime. - _Robert G. Wilson v_, Feb 28 2011

%H T. D. Noe, <a href="/A030664/b030664.txt">Table of n, a(n) for n = 0..1000</a>

%F For n > 1: a(n) = A007917(n)*A007918(n). - _Reinhard Zumkeller_, May 22 2015

%t f[n_] := If[Abs[n] < 2, 1, NextPrime[n + 1, -1] NextPrime[n - 1]]; Array[f, 51, 0] (* _Robert G. Wilson v_, Feb 28 2011 *)

%o (MuPAD) numlib::prevprime(i)*nextprime(i) $ i = 0..50 // _Zerinvary Lajos_, Feb 26 2007

%o (Haskell)

%o a030664 n = a007917 n * a007918 n -- _Reinhard Zumkeller_, May 22 2015, Feb 24 2011

%o (PARI) a(n) = if (n < 2, 1, precprime(n)*nextprime(n)); \\ _Michel Marcus_, Mar 21 2015

%Y Cf. A000040, A013638, A006094, A001248.

%Y Cf. A007917, A007918, A013638.

%K easy,nonn,nice

%O 0,3

%A _N. J. A. Sloane_

%E More terms from _Erich Friedman_