login
Smallest odd prime that is relatively prime to n.
5

%I #24 Jul 25 2022 15:52:40

%S 3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,

%T 3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,

%U 5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3

%N Smallest odd prime that is relatively prime to n.

%C More than the usual number of terms are shown in order to distinguish this from A239278.

%C a(n) = smallest odd prime missing from rad(n).

%C If rad(m) = rad(n), a(m) = a(n) (cf. A007947). - _Bob Selcoe_, Apr 04 2017

%H Antti Karttunen, <a href="/A284723/b284723.txt">Table of n, a(n) for n = 1..100000</a>

%F a(n) = 3 unless n == 0 (mod 3).

%F For n>3, a(n) < 3*log(n).

%F a(n) = A355001(2*n). - _Antti Karttunen_, Jul 18 2022

%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Sum_{p odd prime} ((p*(p-1)/Product_{q odd prime <= p} q)) = 3.8401019546... . - _Amiram Eldar_, Jul 25 2022

%t a[n_] := Module[{p = 3}, While[Divisible[n, p], p = NextPrime[p]]; p]; Array[a, 100] (* _Amiram Eldar_, Jul 25 2022 *)

%o (PARI) a(n) = my(p=3); while(gcd(n, p) != 1, p=nextprime(p+1)); p; \\ _Michel Marcus_, Apr 04 2017; corrected Jun 13 2022

%Y Similar to but different from A239278.

%Y Cf. A007947, A020639, A053669, A284721.

%Y Even bisection of A355001.

%K nonn

%O 1,1

%A _N. J. A. Sloane_, Apr 04 2017