login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Write down the positive integers. To obtain the terms of the sequence, concatenate groups of these so that the last number of each concatenated group is a prime.
1

%I #19 Nov 18 2023 18:13:47

%S 12,3,45,67,891011,1213,14151617,1819,20212223,242526272829,3031,

%T 323334353637,38394041,4243,44454647,484950515253,545556575859,6061,

%U 626364656667,68697071,7273,747576777879,80818283,848586878889,9091929394959697,9899100101,102103

%N Write down the positive integers. To obtain the terms of the sequence, concatenate groups of these so that the last number of each concatenated group is a prime.

%H Michael S. Branicky, <a href="/A367431/b367431.txt">Table of n, a(n) for n = 1..10000</a>

%o (Python)

%o from sympy import prime

%o from itertools import count, islice

%o def a(n):

%o return int("".join(map(str, range(1 if n<2 else prime(n-1)+1, prime(n)+1))))

%o print([a(n) for n in range(1, 31)]) # _Michael S. Branicky_, Nov 18 2023

%o (Python) # faster for generating initial segment of sequence

%o from sympy import isprime

%o from itertools import count, islice

%o def agen():

%o cat = ""

%o for i in count(1):

%o cat += str(i)

%o if isprime(i): yield int(cat); cat = ""

%o print(list(islice(agen(), 30))) # _Michael S. Branicky_, Nov 18 2023

%Y Cf. A000027, A000040.

%K nonn,base

%O 1,1

%A _Tamas Sandor Nagy_, Nov 18 2023