%I #22 May 13 2013 01:50:04
%S 1,2,3,2,5,6,7,2,3,5,11,6,13,7,15,2,17,6,19,5,7,11,23,6,5,13,3,7,29,
%T 30,31,2,11,17,35,6,37,19,13,5,41,6,43,11,15,23,47,6,7,5,17,13,53,6,
%U 11,7,19,29,59,30,61,31,7,2,13,6,67,17,23,35,71,6,73
%N Consider any chain of consecutive primes which divides n; take all longest such chains; maximize the product of the primes in the chain.
%e No primes divide 1, so the empty product 1 = a(1).
%e 4290 = 2 * 3 * 5 * 11 * 13 which is divisible by three consecutive primes 2, 3, and 5 so a(4290) = 2 * 3 * 5 = 30. (11 * 13 is larger but a shorter chain.)
%o (PARI) a(n)=if(n<4,n,my(f=factor(n)[,1],runLen=1,runProd=f[1],rLen=1,rProd=f[1]);for(i=2,#f,if(nextprime(f[i-1]+1)==f[i],runProd*=f[i];runLen++,if(runLen>=rLen,rLen=runLen;rProd=runProd);runLen=1;runProd=f[i]));if(runLen<rLen,rProd,runProd)) \\ _Charles R Greathouse IV_, Mar 02 2012
%K nonn
%O 1,2
%A _Charles R Greathouse IV_, Mar 02 2012
|