OFFSET
1,2
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Rémy Sigrist, Scatterplot of the first 100000 terms (red pixels indicate when n is a multiple of 10)
FORMULA
EXAMPLE
For n = 110:
- the divisors of 110 are: 1, 2, 5, 10, 11, 22, 55, 110,
- 1, 10, 11 and 110 appear as substrings in 110,
- so a(110) = 1 + 10 + 11 + 110 = 132.
MATHEMATICA
Table[DivisorSum[n, # &, StringContainsQ[IntegerString[n], IntegerString[#]] &], {n, 100}] (* Paolo Xausa, Jul 23 2024 *)
PROG
(PARI) a(n, base=10) = { my (d=digits(n, base), s=setbinop((i, j) -> fromdigits(d[i..j], base), [1..#d]), v=0); for (k=1, #s, if (s[k] && n%s[k]==0, v+=s[k])); return (v) }
(Python)
from sympy import divisors
def a(n):
s = str(n)
return sum(d for d in divisors(n, generator=True) if str(d) in s)
print([a(n) for n in range(1, 68)]) # Michael S. Branicky, Jul 10 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 10 2022
STATUS
approved