A061395 Let p be the largest prime factor of n; if p is the k-th prime then set a(n) = k; a(1) = 0 by convention.
0, 1, 2, 1, 3, 2, 4, 1, 2, 3, 5, 2, 6, 4, 3, 1, 7, 2, 8, 3, 4, 5, 9, 2, 3, 6, 2, 4, 10, 3, 11, 1, 5, 7, 4, 2, 12, 8, 6, 3, 13, 4, 14, 5, 3, 9, 15, 2, 4, 3, 7, 6, 16, 2, 5, 4, 8, 10, 17, 3, 18, 11, 4, 1, 6, 5, 19, 7, 9, 4, 20, 2, 21, 12, 3, 8, 5, 6, 22, 3, 2, 13, 23, 4, 7, 14, 10, 5, 24, 3, 6, 9, 11, 15
Offset: 1
Examples
a(20) = 3 since the largest prime factor of 20 is 5, which is the 3rd prime.
Links
- Álvar Ibeas, Table of n, a(n) for n = 1..100000 (first 1000 terms from Harry J. Smith)
- Index entries for sequences computed from indices in prime factorization
Programs
-
Haskell
a061395 = a049084 . a006530 -- Reinhard Zumkeller, Jun 11 2013
-
Maple
with(numtheory): a:= n-> pi(max(1, factorset(n)[])): seq(a(n), n=1..100); # Alois P. Heinz, Aug 03 2013
-
Mathematica
Insert[Table[PrimePi[FactorInteger[n][[ -1]][[1]]], {n, 2, 120}], 0, 1] (* Stefan Steinerberger, Apr 11 2006 *) f[n_] := PrimePi[ FactorInteger@n][[ -1, 1]]; Array[f, 94] (* Robert G. Wilson v, Dec 30 2007 *)
-
PARI
a(n) = if (n==1, 0, primepi(vecmax(factor(n)[,1]))); \\ Michel Marcus, Nov 14 2022
-
Python
from sympy import primepi, primefactors def a(n): return 0 if n==1 else primepi(primefactors(n)[-1]) print([a(n) for n in range(1, 101)]) # Indranil Ghosh, May 14 2017
Formula
Extensions
Definition reworded by N. J. A. Sloane, Jul 01 2008
Comments