login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

The largest noncomposite number k such that n is divisible by all the primes that do not exceed k.
2

%I #12 Oct 13 2024 11:17:19

%S 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,

%T 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,

%U 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

%N The largest noncomposite number k such that n is divisible by all the primes that do not exceed k.

%C First differs from A062356 and A257993 at n = 30.

%C The least index n such that a(n) = prime(k) is A002110(k).

%C 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.

%H Amiram Eldar, <a href="/A376928/b376928.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = 1 if and only if n is odd.

%F a(n) = gpf(n) = A006530(n) if and only if n is in A055932.

%F a(n) = prime(A276084(n)) = A000040(A276084(n))) if A276084(n) > 0, and 1 otherwise.

%F primepi(a(n)) = A000720(a(n)) = A276084(n).

%F A034386(a(n)) = A053589(n).

%F a(n) = prev(A053669(n)), where prev(p) is defined in the Comments section.

%F 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).

%e a(30) = 5 since 30 is divisible by all the primes <= 5, i.e., by 2, 3 and 5.

%t a[n_] := Module[{p = 1}, While[Divisible[n, p], p = NextPrime[p]]; If[p > 2, NextPrime[p, -1], 1]]; Array[a, 100]

%o (PARI) a(n) = {my(p = 1); while(!(n % p), p = nextprime(p+1)); if(p > 2, precprime(p-1), 1);}

%Y Cf. A000040, A000720, A002110, A006530, A034386, A053589, A053669, A055881, A055932, A062356, A151799, A257993, A276084, A377010.

%K nonn,easy

%O 1,2

%A _Amiram Eldar_, Oct 11 2024