login
A380745
a(0) = 0; a(n) = the number of times a(n-1) has the same digits in common with a previous term, in any permutation.
1
0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2
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
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