login
A350153
Prime numbers created by concatenating all numbers 1 through k for some k > 1, then continuing to concatenate all numbers from k-1 towards 1. Primes are added to the sequence as they are found as k increases.
1
12343, 1234543, 12345678910987, 12345678910987654321, 12345678910111213141516171819202122212019181716151413, 12345678910111213141516171819202122232425262728293029
OFFSET
1,1
COMMENTS
A173426(n) is the concatenation of all numbers from 1 up to k and then back down to 1. The prime terms of A173426 have been called "memorable primes" (see the Numberphile video). These "unmemorable primes" are a superset created by concatenating 1..k in ascending order followed by concatenating the numbers k-1..1 in descending order. Any primes found during either concatenation process are added to the sequence (e.g., k = 5, 1234543 is included. If 12345 were prime, it would be included as well).
LINKS
Brady Haran and N. J. A. Sloane, The Most Wanted Prime Number, Numberphile video (2021).
EXAMPLE
For k=10, the first prime obtained by concatenating the numbers 1..10 and then concatenating the first one or more numbers from 9..1 is 12345678910987.
MAPLE
select(isprime, [seq(seq(parse(cat($1..n, n-i$i=1..t)),
t=0..n-1), n=1..30)])[]; # Alois P. Heinz, Dec 19 2021
MATHEMATICA
lst={}; Table[s=Flatten[IntegerDigits/@Range@n]; k=n-1;
While[k!=-1, If[PrimeQ[p=FromDigits@s], AppendTo[lst, p]]; s=Join[s, IntegerDigits@k]; k--], {n, 100}]; lst (* Giorgos Kalogeropoulos, Dec 17 2021 *)
PROG
(Python)
from itertools import count, chain, islice, accumulate
from sympy import isprime
def A350153gen(): return filter(lambda p:isprime(p), (int(s) for n in count(1) for s in accumulate(str(d) for d in chain(range(1, n+1), range(n-1, 0, -1)))))
A350153_list = list(islice(A350153gen(), 20)) # Chai Wah Wu, Dec 20 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Patrick Quam, Dec 16 2021
STATUS
approved