cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A052020 Sum of digits of k is a prime proper factor of k.

Original entry on oeis.org

12, 20, 21, 30, 50, 70, 102, 110, 111, 120, 133, 140, 200, 201, 209, 210, 230, 247, 300, 308, 320, 322, 364, 407, 410, 476, 481, 500, 506, 511, 605, 629, 700, 704, 715, 782, 803, 832, 874, 902, 935, 1002, 1010, 1011, 1015, 1020, 1040, 1066, 1088, 1100, 1101
Offset: 1

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Comments

For each prime p there are infinitely many terms with sum of digits p. - Robert Israel, Feb 26 2017

Crossrefs

Programs

  • Maple
    filter:= proc(n) local s;
      s:= convert(convert(n,base,10),`+`);
      isprime(s) and (n mod s = 0)
    end proc:
    select(filter, [$10..10^4]); # Robert Israel, Feb 26 2017
  • Mathematica
    Select[Range[0, 2000], With[{s = DigitSum[#]}, s < # && Divisible[#, s] && PrimeQ[s]] &] (* Paolo Xausa, May 18 2024 *)
  • Python
    from sympy import isprime
    def ok(n):
        sd = sum(map(int, str(n)))
        return 1 < sd < n and n%sd == 0 and isprime(sd)
    print([k for k in range(1102) if ok(k)]) # Michael S. Branicky, Dec 20 2021