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.

A326398 a(n) is the smallest k > 0 such that the concatenation prime(n)k is composite.

Original entry on oeis.org

1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1
Offset: 1

Views

Author

David James Sycamore, Jun 07 2020

Keywords

Comments

a(n) can only be 1 or 2 for any n >= 1. It appears that there are many more primes for which k = 1 than those for which k = 2 (~ 91% of the first 10^7 primes have k = 1).

Examples

			a(1) = 1 because 21 is prime, a(2) = 2 because 31 is prime (as 3 is in A023237), and 32 is composite
		

Crossrefs

Programs

  • Maple
    P := proc (n)
    if isprime(10*ithprime(n)+1) then return 2 else 1;
    end if:
    end proc;
    P(50);
    seq(P(k), k = 1 .. 50);
  • Mathematica
    Table[k = 1; p = Prime[n]; While[PrimeQ[10^IntegerLength[k]*p + k], k++]; k, {n, 120}] (* Michael De Vlieger, Jun 30 2025 *)
  • PARI
    a(n) = my(k=1, p=Str(prime(n))); while (isprime(eval(concat(p, Str(k)))), k++); k; \\ Michel Marcus, Jun 07 2020

Formula

a(n) = 2 if prime(n) is in A023237, else a(n) = 1. [corrected by Chai Wah Wu, Jul 06 2020]