A376928 The largest noncomposite number k such that n is divisible by all the primes that do not exceed k.
1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 5, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 5, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 5, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1
Offset: 1
Examples
a(30) = 5 since 30 is divisible by all the primes <= 5, i.e., by 2, 3 and 5.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Mathematica
a[n_] := Module[{p = 1}, While[Divisible[n, p], p = NextPrime[p]]; If[p > 2, NextPrime[p, -1], 1]]; Array[a, 100]
-
PARI
a(n) = {my(p = 1); while(!(n % p), p = nextprime(p+1)); if(p > 2, precprime(p-1), 1);}
Comments