OFFSET
1,10
COMMENTS
See A336580 for the positions of 1's.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
FORMULA
a(a(n)) = a(n).
EXAMPLE
For n = 168:
- 168 / 6 = 28, 28 / 2 = 14,
- 168 / 8 = 21,
- so a(168) = 14.
PROG
(PARI) for (n=1, #a=vector(69, k, k), apply (d -> a[n]=min(a[n], a[n/d]), setintersect(Set(digits(n)), divisors(n))); print1 (a[n]", "))
(Python)
def neighs(x):
yield from (x//d for d in list(map(int, str(x))) if d > 0 and x%d == 0)
def A334676(n):
reach, expand = {n}, [n]
while expand:
q = expand.pop()
for r in neighs(q):
if r not in reach:
reach.add(r)
expand.append(r)
return min(reach)
print([A334676(n) for n in range(1, 70)]) # Michael S. Branicky, Aug 23 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 25 2020
STATUS
approved
