login
A376928
The largest noncomposite number k such that n is divisible by all the primes that do not exceed k.
2
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,2
COMMENTS
First differs from A062356 and A257993 at n = 30.
The least index n such that a(n) = prime(k) is A002110(k).
Let p be a prime and prev(p) = A151799(p) if p >= 3, and prev(2) = 1 (i.e., prev(p) is the largest noncomposite number that is smaller than p). Then, the asymptotic density of the occurrences of prev(p) in this sequence is 1/prev(p)# - 1/p#, where # denotes primorial (second definition, A034386). For example, the asymptotic densities of the occurrences of 1, 2, 3, 5 and 7 are 1/2, 1/3, 2/15, 1/35 and 1/231, respectively.
LINKS
FORMULA
a(n) = 1 if and only if n is odd.
a(n) = gpf(n) = A006530(n) if and only if n is in A055932.
a(n) = prime(A276084(n)) = A000040(A276084(n))) if A276084(n) > 0, and 1 otherwise.
primepi(a(n)) = A000720(a(n)) = A276084(n).
A034386(a(n)) = A053589(n).
a(n) = prev(A053669(n)), where prev(p) is defined in the Comments section.
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Sum_{p prime} prev(p) * (1/prev(p)# - 1/p#) = 1.744663405017... (A377010).
EXAMPLE
a(30) = 5 since 30 is divisible by all the primes <= 5, i.e., by 2, 3 and 5.
MATHEMATICA
a[n_] := Module[{p = 1}, While[Divisible[n, p], p = NextPrime[p]]; If[p > 2, NextPrime[p, -1], 1]]; Array[a, 100]
PROG
(PARI) a(n) = {my(p = 1); while(!(n % p), p = nextprime(p+1)); if(p > 2, precprime(p-1), 1); }
KEYWORD
nonn,easy
AUTHOR
Amiram Eldar, Oct 11 2024
STATUS
approved