login
A378775
Prime numbers with monotonically decreasing digits, differing by at most 1.
3
2, 3, 5, 7, 11, 43, 211, 433, 443, 877, 887, 2111, 2221, 3221, 5443, 8887, 9887, 22111, 33211, 43321, 54443, 65543, 76543, 98887, 99877, 322111, 332221, 443221, 444443, 766543, 888887, 988877, 2221111, 3221111, 3222211, 3222221, 3333221, 4322221, 4433333, 4443221
OFFSET
1,1
LINKS
EXAMPLE
211 is a term since 211 is a prime number, the digits of 211 are monotonically decreasing, and the difference between consecutive digits is at most 1.
MAPLE
extend:= proc(x) local d, s, i;
d:= ilog10(x);
s:= floor(x/10^d);
seq(10^(d+1)*i+x, i=s .. min(9, s+1))
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[312218]], ContainsOnly[Drop[IntegerDigits[#], -1]-Rest[IntegerDigits[#]], {0, 1}]&] (* James C. McMahon, Dec 21 2024 *)
PROG
(PARI) isok(p) = if (isprime(p), my(d=digits(p), dd = vector(#d-1, k, d[k+1]-d[k])); (#dd==0) || ((vecmin(dd)>=-1) && (vecmax(dd)<=0))); \\ Michel Marcus, Dec 09 2024
CROSSREFS
Primes in A378808.
Sequence in context: A232183 A289862 A036343 * A058253 A004089 A092791
KEYWORD
nonn,base,look
AUTHOR
Randy L. Ekl, Dec 06 2024
STATUS
approved