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.

Showing 1-2 of 2 results.

A378774 Prime numbers with monotonically increasing digits, increasing by only 0 or 1.

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 67, 89, 223, 233, 677, 1123, 1223, 2333, 4567, 7789, 8999, 23333, 45667, 45677, 55667, 67777, 67789, 77899, 78889, 112223, 344567, 445567, 555677, 556789, 566677, 567899, 666667, 788999, 1112333, 2222333, 3445567, 3445667, 3455567, 3456667, 4455667, 4456789, 4556777
Offset: 1

Views

Author

Randy L. Ekl, Dec 06 2024

Keywords

Examples

			223 is a term since the digits of 223 are monotonically increasing, consecutive digits differ by at most 1, and 223 is prime.
		

Crossrefs

Programs

  • Maple
    extend:= proc(x) local d,s,i;
      d:= ilog10(x);
      s:= floor(x/10^d);
      seq(10^(d+1)*i+x, i=max(1,s-1) .. s)
    end proc:
    R:= 2,3,5,7: count:= 4:
    M:= [1,3,7,9];
    for d from 2 while count < 100 do
      M:= map(extend,M):
      S:= sort(select(isprime,M));
      count:= count+nops(S);
      R:= R,op(S);
    od:
    R; # Robert Israel, Feb 09 2025
  • Mathematica
    Select[Prime[Range[319629]], ContainsOnly[Rest[IntegerDigits[#]]-Drop[IntegerDigits[#], -1], {0, 1}]&] (* James C. McMahon, Dec 21 2024 *)
  • PARI
    isok(p) = if (isprime(p), my(d=digits(p), dd = vector(#d-1, k, d[k+1]-d[k])); (#dd==0) || ((vecmin(dd)>=0) && (vecmax(dd)<=1))); \\ Michel Marcus, Dec 09 2024

A378808 Numbers with monotonically decreasing digits, decreasing by only 0 or 1.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 22, 32, 33, 43, 44, 54, 55, 65, 66, 76, 77, 87, 88, 98, 99, 100, 110, 111, 210, 211, 221, 222, 321, 322, 332, 333, 432, 433, 443, 444, 543, 544, 554, 555, 654, 655, 665, 666, 765, 766, 776, 777, 876, 877, 887, 888, 987, 988, 998, 999
Offset: 1

Views

Author

Randy L. Ekl, Dec 07 2024

Keywords

Examples

			32 is a term since it has monotonically decreasing digits whose difference is at most 1.
33 is a term since it also has monotonically decreasing digits whose difference is at most 1.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[999],SubsetQ[{0,1},-Differences[IntegerDigits[#]]] &] (* Stefano Spezia, Dec 08 2024 *)
  • Python
    from itertools import count, islice
    def bgen(last, d):
        if d == 0: yield tuple(); return
        t = (1, 9) if last == None else (max(0, last-1), last)
        for i in range(t[0], t[1]+1): yield from ((i,)+r for r in bgen(i, d-1))
    def agen(): # generator of terms
        yield from (int("".join(map(str, i))) for d in count(1) for i in bgen(None, d))
    print(list(islice(agen(), 62))) # Michael S. Branicky, Dec 08 2024
Showing 1-2 of 2 results.