OFFSET
1,2
COMMENTS
All primes are terms of this sequence.
Nonprime terms begin 1, 4, 6, 8, 9, 22, 26, 27, ...
This sequence deviates from A072227; they first differ at n=40: a(40) = 81 while A072227(40) = 82. Each of the first 65 terms of A072227 is a term of this sequence. Sequence of different terms: 81, ..., ?
A072227 is not a subsequence; A072227(256) = 1089 and 363 divides 1089 but 3+6+3 does not divide 1+0+8+9. - Charles R Greathouse IV, Sep 12 2012
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
a(40) = 81, the divisors of 81 are 1, 3, 9, 27, 81, with digital sums 1, 3, 9, 9, 9 which all divide the digital sum of 81, i.e., 9.
MATHEMATICA
dsdQ[n_]:=Module[{dsn=Total[IntegerDigits[n]], dsd=Total[ IntegerDigits[ #]]&/@ Divisors[n]}, And@@Divisible[dsn, dsd]]; Select[Range[200], dsdQ] (* Harvey P. Dale, Aug 11 2014 *)
PROG
(PARI) dsum(n)=my(s); while(n, s+=n%10; n\=10); s
is(n)=my(t=dsum(n)); fordiv(n, d, if(t%dsum(d), return(0))); 1 \\ Charles R Greathouse IV, Sep 12 2012
(Python)
from sympy import divisors
def ds(n): return sum(map(int, str(n)))
def ok(n):
dsn = ds(n)
return all(dsn%ds(d) == 0 for d in divisors(n, generator=True))
print([k for k in range(1, 174) if ok(k)]) # Michael S. Branicky, Jun 25 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jaroslav Krizek, Sep 07 2009
STATUS
approved