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.

A004721 Delete all 2's from the sequence of nonnegative integers.

Original entry on oeis.org

0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 13, 14, 15, 16, 17, 18, 19, 0, 1, 3, 4, 5, 6, 7, 8, 9, 30, 31, 3, 33, 34, 35, 36, 37, 38, 39, 40, 41, 4, 43, 44, 45, 46, 47, 48, 49, 50, 51, 5, 53, 54, 55, 56, 57, 58, 59, 60, 61, 6, 63, 64, 65, 66, 67, 68, 69, 70, 71, 7, 73, 74, 75
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    d[n_]:=IntegerDigits[n]; t={0}; Do[If[Union[d[n]]!={2},n=FromDigits[DeleteCases[d[n],2]]; AppendTo[t,n]],{n,75}]; t (* Jayanta Basu, May 17 2013 *)
  • Python
    def A004721(n):
        l = len(str(n))
        m = 2*(10**l-1)//9
        k = n + l - int(n+l < m)
        return 1 if k == m else int(str(k).replace('2','')) # Chai Wah Wu, Apr 20 2021