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.

This page as a plain text file.
%I A381158 #28 Mar 20 2025 10:32:04
%S A381158 2,3,5,7,41,43,61,83,521,541,743,761,941,983,6521,8521,8543,8741,8761,
%T A381158 76541,76543,94321,98321,98543
%N A381158 Prime numbers where digit values decrease while alternating parity.
%e A381158 41 is a term, since the digits decrease in value and alternate even and odd.
%p A381158 b:= proc(n) `if`(isprime(n), n, [][]), seq(b(10*n+j), j=irem(n, 10)-1..1, -2) end:
%p A381158 {seq(b(n), n=1..9)}[];  # _Alois P. Heinz_, Mar 12 2025
%t A381158 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 *)
%o A381158 (Python)
%o A381158 from sympy import isprime
%o A381158 from itertools import combinations
%o A381158 def ap(s): return all((s[i] in "13579") == (s[i+1] in "02468") for i in range(len(s)-1))
%o A381158 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))))
%o A381158 print(afull()) # _Michael S. Branicky_, Mar 10 2025
%Y A381158 Cf. A052014, A000040, A028867, A028864, A052015, A382027.
%K A381158 nonn,base,fini,full
%O A381158 1,1
%A A381158 _James S. DeArmon_, Feb 15 2025