A351328 a(n) is equal to the sum of the factorials of the digits of a(n-1), with a(1) = 0; each time a duplicated term appears, we replace it with the smallest integer not yet in the sequence and iterate.
0, 1, 2, 3, 6, 720, 5043, 151, 122, 5, 120, 4, 24, 26, 722, 5044, 169, 363601, 1454, 7, 5040, 146, 745, 5184, 40465, 889, 443520, 177, 10081, 40324, 57, 5160, 842, 40346, 775, 10200, 8, 40320, 34, 30, 9, 362880, 81369, 403927, 367953, 368772, 51128, 40444, 97, 367920, 368649, 404670, 5810, 40442, 75
Offset: 1
Examples
a(1) = 0; as 0! = 1 we have a(2) = 1; but as 1! = 1 is already in the sequence, we extend it with a(3) = 2, the smallest integer not yet in the sequence; as 2! = 2 (being already in the sequence) we extend it with a(4) = 3; now as 3! = 6 in new, we immediately form a(5) = 6; as 6! = 720 we have a(6) = 720 and a(7) = 7! + 2! + 0! = 5040 + 2 + 1 = 5043; etc. This technique allows us to get rid of all the loops of the kind mentioned in A308259.
Links
- Carole Dubois, Table of n, a(n) for n = 1..10000
- Michael De Vlieger, Scatterplot of a(n), n = 1..10^6.
Crossrefs
Cf. A308259.
Programs
-
Mathematica
c[_] = 0; j = c[1] = 1; Array[Set[f[#], #!] &, 10, 0]; {1}~Join~Reap[Do[While[c[u] > 0, u++]; If[c[#] > 0, Set[k, u], Set[k, #]] &@ Total@ Map[f[#] &, IntegerDigits[j]]; Sow[k]; c[k] = i; j = k, {i, 2, 53}]][[-1, -1]] (* Michael De Vlieger, Feb 07 2022 *)