OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Jean-Marie De Koninck and Florian Luca, On the Middle Prime Factor of an Integer, Journal of Integer Sequences, Vol. 16 (2013), Article 13.5.5.
Nicolas Doyon and Vincent Ouellet, On the sum of the reciprocals of the middle prime factor counting multiplicity, Annales Univ. Sci. Budapest., Sect. Comp. 47 (2018) 249-259.
FORMULA
EXAMPLE
a(30)=a(2*3*5)=3; a(60)=a(2*2*3*5)=2; a(72)=a(2*2*2*3*3)=2; a(90)=a(2*3*3*5)=3; a(108)=a(2*2*3*3*3)=3; a(144)=a(2*2*2*2*3*3)=2; a(216)=a(2*2*2*3*3*3)=2.
MAPLE
f:= proc(n) local F, F2, m, i;
F:= sort(ifactors(n)[2], (i, j) -> i[1]<j[1]);
F2:= ListTools:-PartialSums(map2(op, 2, F));
for i from 1 do
if 2*F2[i]>=F2[-1] then return F[i][1] fi
od
end proc:
1, seq(f(n), n=2..100); # Robert Israel, Aug 25 2015
MATHEMATICA
f[n_] := Block[{p = Flatten[Table[#1, {#2}] & @@@ FactorInteger@ n], len}, len = Length@ p; If[OddQ@ len, p[[1 + Floor[len/2]]], p[[len/2]]]]; {1}~Join~Table[f@ n, {n, 2, 96}] (* Michael De Vlieger, Aug 25 2015 *)
PROG
(PARI) a(n) = {if (n==1, return(1)); my(f=factor(n), v=vector(bigomega(f)), j=1); for (k=1, #f~, for (i=1, f[k, 2], v[j]=f[k, 1]; j++); ); v[(#v+1)\2]; } \\ Michel Marcus, Apr 15 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jan 13 2003
EXTENSIONS
Typo fixed by Franklin T. Adams-Watters, Jul 10 2012
STATUS
approved