login
Number of integers less than n that have the same smallest prime factor as n.
2

%I #13 Nov 21 2024 05:31:02

%S 0,0,0,1,0,2,0,3,1,4,0,5,0,6,2,7,0,8,0,9,3,10,0,11,1,12,4,13,0,14,0,

%T 15,5,16,2,17,0,18,6,19,0,20,0,21,7,22,0,23,1,24,8,25,0,26,3,27,9,28,

%U 0,29,0,30,10,31,4,32,0,33,11,34,0,35,0,36,12,37,2,38,0,39

%N Number of integers less than n that have the same smallest prime factor as n.

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

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/LeastPrimeFactor.html">Least Prime Factor</a>.

%F a(n) = |{j < n : lpf(j) = lpf(n)}|.

%F a(n) = A078898(n) - 1.

%F Sum_{k=1..n} a(k) ~ c * n^2 / 2, where c = Sum_{k>=1} (A038110(k)/A038111(k))^2 = 0.2847976823663... . - _Amiram Eldar_, Nov 21 2024

%t Table[Length[Select[Range[n - 1], If[# == 1, 1, FactorInteger[#][[1, 1]]] == If[n == 1, 1, FactorInteger[n][[1, 1]]] &]], {n, 80}]

%t seq[len_] := Module[{t = Table[FactorInteger[n][[1,1]], {n, 1, len}], s = Table[0, {len}]}, Do[s[[i]] = Count[t[[1;;i-1]], t[[i]]], {i, 1, len}]; s]; seq[80] (* _Amiram Eldar_, Nov 21 2024 *)

%o (PARI) a(n) = if (n>1, my(p=vecmin(factor(n)[,1])); sum(k=2, n-1, p == vecmin(factor(k)[,1])), 0); \\ _Michel Marcus_, Nov 16 2024

%Y Cf. A020639, A038110, A038111, A047983, A078898, A334655, A335097, A377730.

%K nonn

%O 1,6

%A _Ilya Gutkovskiy_, Nov 05 2024