OFFSET
1,1
COMMENTS
Terms must have at least 4 digits.
There are 3287310 terms, with the last being 1245678987653210123456789. - Michael S. Branicky, Jan 26 2024
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
Michael S. Branicky, Python program producing full sequence
James S. DeArmon, Python program for A367735
EXAMPLE
The first term is 1201: increases 1-2, decreases 2-0, then increases 0-1. An example 7-digit term is 1215679.
MAPLE
q:= proc(n) local i, l, s;
l, s:= convert(n, base, 10), 1;
for i to nops(l)-1 while s<5 do s:=
`if`(l[i]=l[i+1], 5,
`if`(l[i]>l[i+1], [2$2, 4$2][s], [5, 3$2, 5][s]))
od; is(s=4)
end:
select(isprime and q, [$1..15000])[]; # Alois P. Heinz, Jan 26 2024
PROG
(Python)
from sympy import isprime
from itertools import combinations, islice
def agen(): # generator of terms
for d in range(4, 28):
print(d)
passed = set()
for d1 in range(2, min(d-2, 9)+1):
for c1 in combinations("123456789", d1):
for d2 in range(1, min(d-d1-1, 10)+1):
digits2 = list(map(str, range(int(c1[-1])-1, -1, -1)))
for c2 in combinations(digits2, d2):
digits3 = list(map(str, range(int(c2[-1])+1, 11)))
for c3 in combinations(digits3, d - d1 - d2):
t = int("".join(c1 + c2 + c3))
if isprime(t):
passed.add(t)
yield from sorted(passed)
print(list(islice(agen(), 63))) # Michael S. Branicky, Jan 26 2024
CROSSREFS
KEYWORD
nonn,base,fini
AUTHOR
James S. DeArmon, Jan 24 2024
STATUS
approved