A120804 Primes with consecutive digits descending.
2, 3, 5, 7, 43, 109, 10987, 76543, 10987654321098765432109876543210987, 4321098765432109876543210987654321098765432109876543210987654321
Offset: 1
Links
- Paul Tek, Table of n, a(n) for n = 1..14
Programs
-
Mathematica
f[n_] := Block[{d = Reverse@ Range@n, t = Table[1, {n}]}, Select[ Drop[ Union@ Flatten@ Table[ FromDigits[ Mod[d + i*t, 10]], {i, 10}], 2], PrimeQ@# &]]; Array[f, 1000] // Flatten
-
Python
from sympy import isprime from itertools import count, islice def bgen(): yield from (int("".join(str((s0-i)%10) for i in range(d))) for d in count(1) for s0 in range(1, 10)) def agen(): yield from filter(isprime, bgen()) print(list(islice(agen(), 10))) # Michael S. Branicky, Aug 05 2022
Extensions
Corrected by Paul Tek, May 08 2013
Comments