A055396 Smallest prime dividing n is a(n)-th prime (a(1)=0).
0, 1, 2, 1, 3, 1, 4, 1, 2, 1, 5, 1, 6, 1, 2, 1, 7, 1, 8, 1, 2, 1, 9, 1, 3, 1, 2, 1, 10, 1, 11, 1, 2, 1, 3, 1, 12, 1, 2, 1, 13, 1, 14, 1, 2, 1, 15, 1, 4, 1, 2, 1, 16, 1, 3, 1, 2, 1, 17, 1, 18, 1, 2, 1, 3, 1, 19, 1, 2, 1, 20, 1, 21, 1, 2, 1, 4, 1, 22, 1, 2, 1, 23, 1, 3, 1, 2, 1, 24, 1, 4, 1, 2, 1, 3, 1
Offset: 1
Keywords
Examples
a(15) = 2 because 15=3*5, 3<5 and 3 is the 2nd prime.
References
- John H. Conway, On Numbers and Games, 2nd Edition, p. 129.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- Douglas E. Iannucci and Urban Larsson, Game values of arithmetic functions, arXiv:2101.07608 [math.NT], 2021.
- Wikipedia, Nimber (explains the term Grundy number).
- Index entries for sequences computed from indices in prime factorization
- Index entries for sequences generated by sieves
Crossrefs
Programs
-
Haskell
a055396 = a049084 . a020639 -- Reinhard Zumkeller, Apr 05 2012
-
Maple
with(numtheory): a:= n-> `if`(n=1, 0, pi(min(factorset(n)[]))): seq(a(n), n=1..100); # Alois P. Heinz, Aug 03 2013
-
Mathematica
a[1] = 0; a[n_] := PrimePi[ FactorInteger[n][[1, 1]] ]; Table[a[n], {n, 1, 96}](* Jean-François Alcover, Jun 11 2012 *)
-
PARI
a(n)=if(n==1,0,primepi(factor(n)[1,1])) \\ Charles R Greathouse IV, Apr 23 2015
-
Python
from sympy import primepi, isprime, primefactors def a049084(n): return primepi(n)*(1*isprime(n)) def a(n): return 0 if n==1 else a049084(min(primefactors(n))) # Indranil Ghosh, May 05 2017
Comments