A380690 a(0) = 0; a(n) = the number of times a(n-1) has all digits in common with a previous term.
0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 12, 0, 12, 1, 13, 0, 13, 1, 14, 0, 14, 1, 15, 0, 15, 1, 16, 0, 16, 1, 17, 0, 17, 1, 18, 0, 18, 1, 19, 0, 19, 1, 20, 0, 20, 1, 21
Offset: 0
Examples
a(24) = 2 since a(23) = 1 and previously there are two numbers that only have the digit '1': a(22) = 11 and a(2) = 1. a(4062) = 113 since a(4061) = 112 and previously there are 113 occurrences of numbers that only have the digits '1' and '2' such as 12,21,112,121,122.
Programs
-
Mathematica
a[0] = 0; a[n_] := a[n] = Count[Array[a, n - 1, 0], ?(Union[IntegerDigits[a[n - 1]]] == Union[IntegerDigits[#]] &)]; Array[a, 100, 0] (* _Amiram Eldar, Jan 30 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(set(str(an)))) an = digsetcount[key] digsetcount[key] += 1 print(list(islice(agen(), 80))) # Michael S. Branicky, Jan 30 2025
Comments