login
A079789
a(n) = number of nonnegative integers m <= n having at least one digit in common with n.
1
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 5, 6, 7, 8, 9, 10, 11, 12, 5, 14, 5, 8, 9, 10, 11, 12, 13, 14, 7, 16, 17, 7, 11, 12, 13, 14, 15, 16, 9, 18, 19, 20, 9, 14, 15, 16, 17, 18, 11, 20, 21, 22, 23, 11, 17, 18, 19, 20, 13, 22, 23, 24, 25, 26, 13, 20, 21, 22, 15, 24, 25, 26, 27, 28, 29
OFFSET
0,11
LINKS
EXAMPLE
a(10) = 3 and the numbers m are: 0,1,10. a(14) = 7 with m = 1,4,10,11,12,13,14.
MAPLE
S:= Array(0..10000, n -> convert(convert(n, base, 10), set)):
f:= proc(n) nops(select(t -> S[t] intersect S[n] <> {}, [$0..n])) end proc:
map(f, [$0..100]); # Robert Israel, Dec 03 2024
PROG
(Python)
from collections import Counter
from itertools import count, islice
def agen(): # generator of terms
dig_sets = dict()
for n in count(0):
ss = set(str(n))
key = "".join(sorted(ss))
if key not in dig_sets:
dig_sets[key] = [ss, 0]
dig_sets[key][1] += 1
c = sum(dig_sets[k][1] for k in dig_sets if dig_sets[k][0]&ss)
yield c
print(list(islice(agen(), 77))) # Michael S. Branicky, Dec 03 2024
CROSSREFS
Sequence in context: A161560 A078796 A201929 * A131209 A116592 A152772
KEYWORD
easy,nonn,base,look
AUTHOR
Amarnath Murthy, Feb 04 2003
EXTENSIONS
Corrected and extended by Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Apr 19 2003
STATUS
approved