OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..2500
FORMULA
a(n) = min { m >= 0 : A266477(m,n) > 0 }.
p in primes => a(p) = p.
MAPLE
b:= proc(n, i, p) option remember; `if`(n=0, `if`(p=1, 1, 0),
`if`(i<1, 0, b(n, i-1, p)+add(`if`(irem(p, j)=0,
b(n-i*j, i-1, p/j), 0), j=1..n/i)))
end:
a:= proc(n) option remember; local m;
if isprime(n) then return n fi;
for m from 0 do if b(m$2, n)>0 then return m fi od
end:
seq(a(n), n=1..100);
MATHEMATICA
b[n_, i_, p_] := b[n, i, p] = If[n == 0, If[p == 1, 1, 0], If[i < 1, 0, b[n, i - 1, p] + Sum[If[Mod[p, j] == 0, b[n - i*j, i - 1, p/j], 0], {j, 1, n/i}]]]; a[n_] := a[n] = Module[{m}, If[PrimeQ[n], Return[n]]; For[m = 0, True, m++, If[b[m, m, n] > 0, Return[m]]]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Dec 21 2016, translated from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Emeric Deutsch and Alois P. Heinz, Jan 04 2016
STATUS
approved