login
a(1)=2; if n = Product p_i^e_i, n > 1, then a(n) = Product p_{i+1}^e_i.
17

%I #27 May 18 2020 03:02:31

%S 2,3,5,9,7,15,11,27,25,21,13,45,17,33,35,81,19,75,23,63,55,39,29,135,

%T 49,51,125,99,31,105,37,243,65,57,77,225,41,69,85,189,43,165,47,117,

%U 175,87,53,405,121,147,95,153,59,375,91,297,115,93,61,315,67,111,275,729,119

%N a(1)=2; if n = Product p_i^e_i, n > 1, then a(n) = Product p_{i+1}^e_i.

%D From a puzzle proposed by _Marc LeBrun_.

%H Indranil Ghosh, <a href="/A045965/b045965.txt">Table of n, a(n) for n = 1, 10000</a>

%p succfactorization := proc(n) local p,d; if(1 = n) then RETURN(2); fi; p := 1; for d in ifactors(n)[ 2 ] do p := p * (nextprime(d[ 1 ])^d[ 2 ]); od; RETURN(p); end;

%t a[1] = 2; a[p_?PrimeQ] := a[p] = Prime[PrimePi[p] + 1]; a[n_] := a[n] = Times @@ (a[First[#]]^Last[#] &) /@ FactorInteger[n]; Table[ a[n], {n, 1, 65}] (* _Jean-François Alcover_, Jul 18 2013 *)

%o (Haskell)

%o a045965 n = if n == 1 then 2 else a003961 n

%o -- _Reinhard Zumkeller_, Jul 12 2012

%o (Python)

%o from sympy import factorint, primepi, prime, prod

%o def a(n):

%o f=factorint(n)

%o return 2 if n==1 else prod(prime(primepi(i) + 1)**f[i] for i in f) # _Indranil Ghosh_, May 15 2017

%o (PARI) a(n) = if (n==1, 2, my(f=factor(n)); for(i=1, #f~, f[i,1] = nextprime(f[i,1]+1)); factorback(f)); \\ _Michel Marcus_, May 18 2020

%Y Cf. A048673. Essentially identical to A003961.

%K easy,nonn,nice

%O 1,1

%A _N. J. A. Sloane_

%E More terms from _David W. Wilson_