A056240 Smallest number whose prime divisors (taken with multiplicity) add to n.
2, 3, 4, 5, 8, 7, 15, 14, 21, 11, 35, 13, 33, 26, 39, 17, 65, 19, 51, 38, 57, 23, 95, 46, 69, 92, 115, 29, 161, 31, 87, 62, 93, 124, 155, 37, 217, 74, 111, 41, 185, 43, 123, 86, 129, 47, 215, 94, 141, 188, 235, 53, 329, 106, 159, 212, 265, 59, 371, 61, 177, 122
Offset: 2
Examples
a(8) = 15 = 3*5 because 15 is the smallest number whose prime divisors sum to 8. a(10000) = 586519: Let pp(n) be the largest prime < n and the candidate being the current value that might be a(10000). Then we see that pp(10000 - 1) = 9973, giving a candidate 9973 * a(10000 - 9973) = 9973 * 92. pp(9973) = 9967, giving a candidate 9967 * a(10000 - 9967) = 9967 * 62. pp(9967) = 9949, giving the candidate 9949 * a(10000 - 9949) = 9962 * 188. This is larger than our candidate so we keep 9967 * 62 as our candidate. pp(9949) = 9941, giving a candidate 9941 * pp(10000 - 9941) = 9941 * 59. We see that (n - p) * a(p) >= (n - p) * p > candidate = 9941 * 59 for p > 59 so we stop iterating to conclude a(10000) = 9941 * 59 = 586519. - _David A. Corneth_, Mar 23 2018, edited by _M. F. Hasler_, Jan 19 2019
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 2..10000
- Hans Havermann, Tables of sum-of-prime-factors sequences (overview with links to the first 50000 sums).
Crossrefs
Programs
-
Haskell
a056240 = (+ 1) . fromJust . (`elemIndex` a001414_list) -- Reinhard Zumkeller, Jun 14 2012
-
Maple
A056240 := proc(n) local k ; for k from 1 do if A001414(k) = n then return k ; end if; end do: end proc: seq(A056240(n),n=2..80) ; # R. J. Mathar, Apr 15 2024
-
Mathematica
a = Table[0, {75}]; Do[b = Plus @@ Flatten[ Table[ #1, {#2}] & @@@ FactorInteger[n]]; If[b < 76 && a[[b]] == 0, a[[b]] = n], {n, 2, 1000}]; a (* Robert G. Wilson v, May 04 2002 *) b[n_] := b[n] = Total[Times @@@ FactorInteger[n]]; a[n_] := For[k = 2, True, k++, If[b[k] == n, Return[k]]]; Table[a[n], {n, 2, 63}] (* Jean-François Alcover, Jul 03 2017 *)
-
PARI
isok(k, n) = my(f=factor(k)); sum(j=1, #f~, f[j,1]*f[j,2]) == n; a(n) = my(k=2); while(!isok(k, n), k++); k; \\ Michel Marcus, Jun 21 2017
-
PARI
a(n) = {if(n < 7, return(n + 2*(n==6))); my(p = precprime(n), res); if(p == n, return(p), p = precprime(n - 2); res = p * a(n - p); while(res > (n - p) * p && p > 2, p = precprime(p - 1); res = min(res, a(n - p) * p)); res)} \\ David A. Corneth, Mar 23 2018
-
PARI
A056240(n, p=n-1, m=oo)=if(n<6 || isprime(n), n, n==6, 8, until(p<3 || (n-p=precprime(p-1))*p >= m=min(m,A056240(n-p)*p),); m) \\ M. F. Hasler, Jan 19 2019
Formula
Trivial but essential: a(n) >= n. - David A. Corneth, Mar 23 2018
a(n) >= n with equality iff n = 4 or n is prime. - M. F. Hasler, Jan 19 2019
Extensions
More terms from James Sellers, Aug 25 2000
Comments