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.

A381158 Prime numbers where digit values decrease while alternating parity.

Original entry on oeis.org

2, 3, 5, 7, 41, 43, 61, 83, 521, 541, 743, 761, 941, 983, 6521, 8521, 8543, 8741, 8761, 76541, 76543, 94321, 98321, 98543
Offset: 1

Views

Author

James S. DeArmon, Feb 15 2025

Keywords

Examples

			41 is a term, since the digits decrease in value and alternate even and odd.
		

Crossrefs

Programs

  • Maple
    b:= proc(n) `if`(isprime(n), n, [][]), seq(b(10*n+j), j=irem(n, 10)-1..1, -2) end:
    {seq(b(n), n=1..9)}[];  # Alois P. Heinz, Mar 12 2025
  • Mathematica
    ad=Select[Prime[Range[10^6]],Reverse[Union[IntegerDigits[#]]]==IntegerDigits[#]&];fQ[n_] := Block[{m = Mod[ IntegerDigits@ n, 2]}, m == Split[m, UnsameQ][[1]]];Select[ad,fQ] (* James C. McMahon, Mar 20 2025 *)
  • Python
    from sympy import isprime
    from itertools import combinations
    def ap(s): return all((s[i] in "13579") == (s[i+1] in "02468") for i in range(len(s)-1))
    def afull(): return sorted(t for d in range(1, 10) for c in combinations("987654321", d) if ap(c) and isprime(t:=int("".join(c))))
    print(afull()) # Michael S. Branicky, Mar 10 2025