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.

A030477 Numbers k such that k^2 has property that all even digits occur together and all odd digits occur together.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 17, 18, 20, 21, 22, 24, 25, 28, 29, 30, 32, 34, 38, 40, 42, 44, 45, 47, 49, 51, 53, 56, 58, 60, 62, 65, 67, 68, 72, 76, 78, 79, 80, 83, 86, 88, 91, 92, 93, 98, 100, 102, 108, 118, 120, 122, 124, 132, 134, 138, 140
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A030476.

Programs

  • Maple
    filter:= proc(n) local L,x,m;
      L:= convert(n^2,base,10) mod 2;
      if n::odd then
        if not member(0,L,m) then return true fi;
        convert(L[m..-1],set) = {0}
      else
        if not member(1,L,m) then return true fi;
        convert(L[m..-1],set) = {1}
      fi
    end proc:
    select(filter, [$0..1000]); # Robert Israel, Oct 27 2024
  • Python
    def ok(n):
        s = "".join("0" if d in "02468" else "1" for d in str(n**2))
        return len(set(s.rstrip(s[-1]))) < 2
    print([k for k in range(141) if ok(k)]) # Michael S. Branicky, Oct 27 2024