OFFSET
0,5
COMMENTS
To find a(n), let L be the multiset of the digits of a(n-1). Then a(n) is the number of terms a(i), 0 <= i <= n-2, which also have L as the multiset of its digits. - N. J. A. Sloane, Mar 27 2025
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
EXAMPLE
a(43) = 1 since a(42) = 21 and previously there is only one number in the sequence that contains both a 1 and a 2.
a(104) = 3 since a(103) = 11 and previously there are 3 numbers in the sequence that contain two 1's.
a(9942) = 14 since a(9941) = 155 and previously there are 14 numbers in the sequence that contain one 1 and two 5's.
MATHEMATICA
a[0] = 0; a[n_] := a[n] = Count[Array[a, n - 1, 0], _?(Sort[IntegerDigits[a[n - 1]]] == Sort[IntegerDigits[#]] &)]; Array[a, 100, 0] (* Amiram Eldar, Jan 31 2025 *)
PROG
(Python)
from collections import Counter
from itertools import count, islice
def agen(): # generator of terms
an, digsetcount = 0, Counter()
while True:
yield an
key = "".join(sorted(str(an)))
an = digsetcount[key]
digsetcount[key] += 1
print(list(islice(agen(), 82))) # Michael S. Branicky, Mar 24 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Sergio Pimentel, Jan 31 2025
STATUS
approved
