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.
%I A371378 #26 Mar 22 2024 20:26:37 %S A371378 1021,1031,1051,1061,1063,1087,1091,1093,1097,2053,2063,2081,2083, %T A371378 2087,2131,2141,2143,2153,2161,3041,3061,3083,3121,3163,3181,3187, %U A371378 3191,3251,3253,3271,4021,4051,4073,4091,4093,4153,4231,4241,4243,4253,4261,4271,4273,4283 %N A371378 Prime numbers wherein digit values decrease, increase, and finally decrease. %C A371378 Terms must have at least 4 digits. The sequence is finite. %C A371378 There are 3136837 terms, with the last being 98765432101234567987654321. - _Michael S. Branicky_, Mar 20 2024 %H A371378 Alois P. Heinz, <a href="/A371378/b371378.txt">Table of n, a(n) for n = 1..10000</a> %H A371378 Michael S. Branicky, <a href="/A371378/a371378_1.txt">Alternative Python program for full sequence A371378</a> %H A371378 James S. DeArmon, <a href="/A371378/a371378.txt">LISP Code for A371378</a> %p A371378 q:= proc(n) local i, l, s; %p A371378 l, s:= convert(n, base, 10), 1; %p A371378 for i to nops(l)-1 while s<5 do s:= %p A371378 `if`(l[i]=l[i+1], 5, %p A371378 `if`(l[i]<l[i+1], [2$2, 4$2][s], [5, 3$2, 5][s])) %p A371378 od; is(s=4) %p A371378 end: %p A371378 select(isprime and q, [$1..15000])[]; # _Alois P. Heinz_, Mar 21 2024 %t A371378 Select[Prime[Range[600]], SplitBy[Sign[Differences[IntegerDigits[#]]], Sign][[;; , 1]] == {-1, 1, -1} &] (* _Amiram Eldar_, Mar 21 2024 *) %o A371378 (Python) %o A371378 from sympy import isprime %o A371378 from itertools import combinations, islice %o A371378 def agen(): # generator of terms %o A371378 for d in range(4, 29): %o A371378 print(d) %o A371378 passed = set() %o A371378 for d1 in range(2, min(d-2, 11)+1): %o A371378 for c1 in combinations("9876543210", d1): %o A371378 for d2 in range(1, min(d-d1-1, 10)+1): %o A371378 digits2 = list(map(str, range(int(c1[-1])+1, 10))) %o A371378 for c2 in combinations(digits2, d2): %o A371378 digits3 = list(map(str, range(int(c2[-1])-1, -1, -1))) %o A371378 for c3 in combinations(digits3, d - d1 - d2): %o A371378 t = int("".join(c1 + c2 + c3)) %o A371378 if isprime(t): %o A371378 passed.add(t) %o A371378 yield from sorted(passed) %o A371378 print(list(islice(agen(), 63))) # _Michael S. Branicky_, Mar 20 2024 %Y A371378 Cf. A062351, A062352, A156116, A367735. %K A371378 nonn,base,fini %O A371378 1,1 %A A371378 _James S. DeArmon_, Mar 20 2024 %E A371378 More terms from _Michael S. Branicky_, Mar 20 2024