OFFSET
0,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
FORMULA
a(n) = min { j > 0 : A317240(j) = n }.
EXAMPLE
a(1) = 1: 1.
a(2) = 13: 1 + 2 * (1 + 5) = 1 + 3 * (1 + 3) = 13.
a(3) = 31: 1 + 2 * (1 + 2 * (1 + 2 * (1 + 2))) = 1 + 3 * (1 + 3 * (1 + 2)) = 1 + 5 * (1 + 5) = 31.
MAPLE
b:= proc(n) option remember; `if`(n=1, 1,
add(b((n-1)/p), p=numtheory[factorset](n-1)))
end:
a:= proc(n) option remember; local k;
for k while n<>b(k) do od; k
end:
seq(a(n), n=0..50);
MATHEMATICA
pp[n_] := pp[n] = FactorInteger[n][[All, 1]];
q[n_] := q[n] = Switch[n, 1, True, 2, False, _, AnyTrue[pp[n-1], q[(n-1)/#]&]];
b[n_] := b[n] = Which[n == 1, 1, ! q[n], 0, True, Sum[b[(n-1)/p], {p, pp[n-1]}]];
a[n_] := Module[{k}, For[k = 1, True, k++, If[n == b[k], Return[k]]]];
Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Dec 07 2023, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jul 26 2018
STATUS
approved