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....

Original entry on oeis.org

2, 23, 3, 5, 4567, 67, 7, 23456789, 89, 1234567891, 4567891, 67891, 56789101, 789101, 89101, 101, 11, 12345678910111, 45678910111, 10111, 45678910111213, 678910111213, 78910111213, 11213, 1213, 13, 9101112131, 1112131, 2131, 131, 31, 11213141, 1213141, 41, 91011121314151, 151, 123456789101112131415161
Offset: 1

Views

Author

Gonzalo Martínez, May 09 2025

Keywords

Comments

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.
Leading 0 digits are not included in a prime substring, though in fact including them makes no difference to the result.
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.
This sequence is a permutation of the primes since each prime occurs in the concatenation as itself or earlier.

Examples

			Concatenation 123 has primes 23 and 3 ending at the 3, and 23 is in the sequence first since its substring starts first.
		

Crossrefs

Programs

  • Python
    import sympy
    def concat_up_to_k(k):
           return ''.join(str(i) for i in range(1, k + 1))
    def primes_in_substrings(s):
        A383790 = []
        prime_set = set()
        for i in range(1, len(s) + 1):
            for j in range(i):
                substring = s[j:i]
                if substring[0] != '0':
                    num = int(substring)
                    if sympy.isprime(num) and num not in prime_set:
                       A383790.append(num)
                       prime_set.add(num)
        return A383790
    k = 17
    number_string = concat_up_to_k(k)
    A383790 = primes_in_substrings(number_string)
    print(A383790)