cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A383790 Prime numbers in order of occurrence as substrings in the concatenation of natural numbers 123456789101112....

This page as a plain text file.
%I A383790 #22 May 27 2025 17:19:05
%S A383790 2,23,3,5,4567,67,7,23456789,89,1234567891,4567891,67891,56789101,
%T A383790 789101,89101,101,11,12345678910111,45678910111,10111,45678910111213,
%U A383790 678910111213,78910111213,11213,1213,13,9101112131,1112131,2131,131,31,11213141,1213141,41,91011121314151,151,123456789101112131415161
%N A383790 Prime numbers in order of occurrence as substrings in the concatenation of natural numbers 123456789101112....
%C A383790 Primes are ordered first by where they end in the concatenation, and then by where they start if multiple primes end at the same location.
%C A383790 Leading 0 digits are not included in a prime substring, though in fact including them makes no difference to the result.
%C A383790 An equivalent construction is to successively append one digit to the concatenation and add to the sequence all primes in it which are not already seen, ordered by their start position.
%C A383790 This sequence is a permutation of the primes since each prime occurs in the concatenation as itself or earlier.
%e A383790 Concatenation 123 has primes 23 and 3 ending at the 3, and 23 is in the sequence first since its substring starts first.
%o A383790 (Python)
%o A383790 import sympy
%o A383790 def concat_up_to_k(k):
%o A383790        return ''.join(str(i) for i in range(1, k + 1))
%o A383790 def primes_in_substrings(s):
%o A383790     A383790 = []
%o A383790     prime_set = set()
%o A383790     for i in range(1, len(s) + 1):
%o A383790         for j in range(i):
%o A383790             substring = s[j:i]
%o A383790             if substring[0] != '0':
%o A383790                 num = int(substring)
%o A383790                 if sympy.isprime(num) and num not in prime_set:
%o A383790                    A383790.append(num)
%o A383790                    prime_set.add(num)
%o A383790     return A383790
%o A383790 k = 17
%o A383790 number_string = concat_up_to_k(k)
%o A383790 A383790 = primes_in_substrings(number_string)
%o A383790 print(A383790)
%Y A383790 Cf. A033307, A073175, A176942.
%K A383790 nonn,base
%O A383790 1,1
%A A383790 _Gonzalo Martínez_, May 09 2025