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.

Showing 1-2 of 2 results.

A343717 a(n) is the smallest number that yields a prime when appended to n!.

Original entry on oeis.org

1, 1, 3, 1, 1, 1, 7, 11, 29, 17, 43, 29, 13, 47, 19, 73, 37, 19, 41, 103, 41, 31, 43, 1, 113, 31, 37, 59, 41, 53, 41, 47, 1, 41, 149, 37, 53, 73, 337, 1, 103, 151, 293, 47, 107, 509, 127, 71, 167, 197, 167, 149, 67, 163, 139, 251, 59, 107, 241, 331, 269, 1, 149
Offset: 0

Views

Author

Jon E. Schoenfield, May 17 2021

Keywords

Comments

Appending to n! any number k <= n yields a multiple of k; that multiple cannot be prime except at k=1, so, for every n, a(n)=1 or a(n) > n.
a(n) = 1 iff n = 0 or n is in A024912.
See A068695 for a proof that a(n) always exists. - Felix Fröhlich, May 18 2021
If a(n) is composite, then a(n) > 2n. - Michael S. Branicky, May 18 2021

Examples

			n=1: 1! = 1; appending a 1 yields 11, a prime, so a(1)=1.
n=2: 2! = 2; appending a 1 yields 21 = 3*7, and appending a 2 yields 22 = 2*11, but appending a 3 yields 23 (a prime), so a(2)=3.
n=19: 19! = 121645100408832000; appending any number < 103 yields a composite, but 121645100408832000103 is a prime, so a(19)=103.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local k, t; t:= n!;
          for k while not isprime(parse(cat(t, k))) do od; k
        end:
    seq(a(n), n=0..62);  # Alois P. Heinz, May 17 2021
  • Mathematica
    Array[Block[{m = #!, k = 0}, While[! PrimeQ[10^If[k == 0, 1, IntegerLength[k]]*m + k], k++]; k] &, 62] (* Michael De Vlieger, May 17 2021 *)
    snp[n_]:=Module[{nf=n!,c=1},While[!PrimeQ[nf*10^IntegerLength[c]+c],c++];c]; Array[snp,70,0] (* Harvey P. Dale, Oct 17 2024 *)
  • PARI
    for(n=0,62,my(f=digits(n!));forstep(k=1,oo,2,my(p=fromdigits(concat(f,digits(k))));if(ispseudoprime(p),print1(k,", ");break))) \\ Hugo Pfoertner, May 18 2021
  • Python
    # see link for faster program producing b-file
    from sympy import factorial, isprime
    def a(n):
      start = str(factorial(n))
      end = 1
      while not isprime(int(start + str(end))): end += 2
      return end
    print([a(n) for n in range(63)]) # Michael S. Branicky, May 17 2021
    

Formula

a(n) = A068695(n!) = A068695(A000142(n)).

A343719 Indices at which record values occur in A343717.

Original entry on oeis.org

0, 2, 6, 7, 8, 10, 13, 15, 19, 24, 34, 38, 45, 74, 93, 97, 122, 228, 478, 547, 556, 621, 745, 916, 1057, 1090, 1188, 1318, 1467, 1821, 2073, 2601
Offset: 1

Views

Author

Jon E. Schoenfield, May 17 2021

Keywords

Crossrefs

Programs

  • Mathematica
    With[{s = Array[Block[{m = #!, k = 0}, While[! PrimeQ[10^If[k == 0, 1, IntegerLength[k]]*m + k], k++]; k] &, 250] }, Map[FirstPosition[s, #][[1]] &, Union@ FoldList[Max, s]] ] (* Michael De Vlieger, May 17 2021 *)
  • Python
    # see linked program in A343717

Extensions

a(20)-a(23) from Michael S. Branicky, May 18 2021
a(24) from Michael S. Branicky, May 19 2021
a(25)-a(31) from Chai Wah Wu, May 25 2021
a(32) from Lucas A. Brown, Dec 27 2022
Showing 1-2 of 2 results.