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.

Previous Showing 21-21 of 21 results.

A385158 Numbers k such that the sum of the digits of k is a number that appears as a substring of k, and every nonzero digit of k appears in that sum.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 199, 200, 300, 400, 500, 600, 700, 800, 900, 919, 1000, 1188, 1818, 1881, 1909, 1990, 2000, 2999, 3000, 4000, 5000, 6000, 7000, 8000, 8118, 8181, 9000, 9019, 9190, 9299, 9929, 10000
Offset: 1

Views

Author

Rivka Maryles, Jun 19 2025

Keywords

Examples

			1818 is in the sequence because 1 + 8 + 1 + 8 = 18, and 18 appears within the number. Also, all nonzero digits (1 and 8) are found in the digit sum (18).
		

Crossrefs

Cf. A052018, A007953, A031286 (numbers containing a given substring), A070939 (numbers equal to the sum of their digits concatenated), A061209 (numbers containing their digit sum).

Programs

  • Maple
    filter:= proc(k) local L,s,S,nL,nS,i;
      L:= convert(k,base,10);
      nL:= nops(L);
      s:= convert(L,`+`);
      S:= convert(s,base,10);
      nS:= nops(S);
      (convert(L,set) minus {0} = convert(S,set) minus {0}) and member(S, [seq(L[i..i+nS-1],i=1..nL-nS+1)])
    end proc:
    select(filter, [$1..10000]); # Robert Israel, Jul 23 2025
  • Mathematica
    isok[n_] := Module[{digits, sum, sumStr},
      digits = IntegerDigits[n];
      sum = Total[digits];
      sumStr = ToString[sum];
      StringContainsQ[ToString[n], sumStr] &&
        AllTrue[DeleteCases[digits, 0],
          DigitCount[sum, 10, #] > 0 &]
    ];
    Select[Range[9999], isok]
  • Python
    def ok(n):
        digits = str(n)
        digit_sum_str = str(sum(map(int, digits)))
        return digit_sum_str in digits and all(d in digit_sum_str for d in set(digits) - {'0'})
    print([k for k in range(1, 10001) if ok(k)])
Previous Showing 21-21 of 21 results.