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.
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
Examples
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.
Links
- Michael S. Branicky, Table of n, a(n) for n = 0..10000
Programs
-
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 *)
-
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
Comments