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-9 of 9 results.

A341717 a(n) = smallest m >= n such that the decimal concatenation n||n+1||n+2||...||m is prime, or -1 if no such prime exists.

Original entry on oeis.org

2, 3, 7, 5, 7, 7, 9, 187
Offset: 2

Views

Author

N. J. A. Sloane, Feb 22 2021

Keywords

Comments

These are the values of n+k from A341715. See that entry for more information.
See A084559 (the same for nonprime indices) for further information. - M. F. Hasler, Feb 22 2021
Suppose n > 3. If n == 2 (mod 3), then a(n) == 3 or 5 (mod 6). If n = 0 or 1 (mod 3), then a(n) == 1 (mod 6) (see A341716). - Chai Wah Wu, Feb 22 2021

Crossrefs

Programs

  • Mathematica
    Array[Block[{k = #, s = #}, While[! PrimeQ[s], k++; s = FromDigits[IntegerDigits[s]~Join~IntegerDigits[k]]]; k] &, 8, 2] (* Michael De Vlieger, Feb 22 2021 *)
  • PARI
    A341717(n)=if(isprime(n), n, A084559(n)) \\ M. F. Hasler, Feb 22 2021

Formula

a(n) = n iff n is prime, otherwise a(n) = A084559(n). - M. F. Hasler, Feb 22 2021

A341716 a(n) = smallest k such that the decimal concatenation n||n+1||n+2||...||n+k is prime, or -1 if no such prime exists.

Original entry on oeis.org

0, 0, 3, 0, 1, 0, 1, 178
Offset: 2

Views

Author

N. J. A. Sloane, Feb 22 2021

Keywords

Comments

These are the values of k from A341715. See that entry for more information.
From Chai Wah Wu, Feb 22 2021: (Start)
Theorem: For n > 1, a(n)+n is odd. If a(n) > 0, then a(n) !== 2 (mod 3) and a(n)+2n !== 0 (mod 3).
Proof: For n > 1, n||n+1||...||n+k needs to be odd to be prime, i.e., n+k is odd. n||n+1||...||n+k can be written as x+y where x = n||n||...||n||n and y = 1||0...2||...||0...k. The only exception is when n+i has more decimal digits than n for some i <= k in which case there are some extra zeros inserted into x and y.
In any case x is divisible by n and by 10..10..1 whose digit sum is k+1, i.e., x == n*(k+1) (mod 3).
Similarly the sum of digits of y mod 3 == Sum_{i=1..k} (i mod 3) == (Sum_{i=1..k} i) == k(k+1)/2 (mod 3). This means that x+y == (k+1)(k+2n)/2 (mod 3). If either k+1 or k+2n is a multiple of 3, then x+y is a multiple of 3. We know x+y > 3 since a(n) > 0 and thus x+y is not a prime.
Corollary: Suppose n > 3. If n == 0 (mod 6), then a(n) == 1 (mod 6). If n == 1 (mod 6), then a(n) == 0 (mod 6). If n == 2 (mod 6), then a(n) == 1 or 3 (mod 6). If n == 3 (mod 6), then a(n) == 4 (mod 6). If n == 4 (mod 6), then a(n) == 3 (mod 6). If n == 5 (mod 6), then a(n) == 0 or 4 (mod 6).
(End)

Crossrefs

Formula

a(n) = 0 iff n is prime, otherwise a(n) = A084559(n)-n. - M. F. Hasler, Feb 22 2021

A084559 Smallest a(n) > n such that concatenation of numbers from n to a(n) is a prime or 0 if no such number exists.

Original entry on oeis.org

3, 19, 7, 17, 7, 13, 9, 187
Offset: 2

Views

Author

Zak Seidov, Jun 27 2003

Keywords

Comments

Terms a(1) and a(10) (and many other terms) are currently unknown.
a(11) = 309, a(12) = 13.
a(1) > 344869 (see A007908). - Sean A. Irvine, Jun 17 2019
More terms: a(14..17) = (17, 19, 43, 39), a(20) = 23, a(23) = 41, a(25) = 49, a(26) = 147, a(28) = 73, a(33..39) = (103, 37, 603, 37, 43, 57, 43), a(42) = 43, a(44) = 51, a(49) = 241, a(50) = 51, a(n) > 1000 for 12 < n < 50 not mentioned here. - M. F. Hasler, Feb 22 2021
a(10) > 10010, a(18) = 3607, a(66) = 1003, a(275) = 1089. If n == 2 (mod 3), then a(n) == 3 or 5 (mod 6). If n == 0 or 1 (mod 3), then a(n) == 1 (mod 6) (see A341716). - Chai Wah Wu, Feb 22 2021
a(10) > 50000. - Michael S. Branicky, Feb 25 2025

Examples

			a(4) = 7 because 4567 is a prime.
		

Crossrefs

Cf. also A341715, A341716, A341717 (similar but a(n) = n when n is prime).

Programs

  • PARI
    A084559(n,N=n,T=10^logint(n,10))=while(T*=10,for(m=n+1,n=T-1,ispseudoprime(N=N*T+m)&&return(m))) \\ M. F. Hasler, Feb 22 2021

Extensions

Edited by Max Alekseyev, Jan 28 2012
a(4) corrected by Daniel Suteu, Jun 16 2019
Escape clause added to definition by Chai Wah Wu, Feb 22 2021

A140793 Smallest prime which is the concatenation of 2 or more consecutive numbers starting with n, or -1 if no such prime exists.

Original entry on oeis.org

23, 345678910111213141516171819, 4567, 567891011121314151617, 67, 78910111213, 89
Offset: 2

Views

Author

Lekraj Beedassy, Jul 15 2008

Keywords

Comments

Comment from Ray G. Opao, Sep 30 2008: a(9) is the following number:
91011121314151617181920212223242526272829303132333435363738394041424
34445464748495051525354555657585960616263646566676869707172737475767
77879808182838485868788899091929394959697989910010110210310410510610
71081091101111121131141151161171181191201211221231241251261271281291
30131132133134135136137138139140141142143144145146147148149150151152
15315415515615715815916016116216316416516616716816917017117217317417
5176177178179180181182183184185186187.

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{c = n, k = n + 1}, While[c = 10^IntegerLength[k] c + k; p = c; !PrimeQ[c], k++]; c]; Table[f[n], {n, 2, 8}] (* Robert G. Wilson v, Jun 24 2012 *)
    pr[n_]:=Module[{k=1},While[!PrimeQ[FromDigits[Flatten[IntegerDigits/@Range[n,n+k]]]],k++];FromDigits[Flatten[IntegerDigits/@Range[n,n+k]]]]; Array[pr,8,2] (* Harvey P. Dale, Mar 14 2014 *)
  • PARI
    A140793(n,N=n,T=10^logint(n,10))=while(T*=10,for(m=n+1,n=T-1,ispseudoprime(N=N*T+m)&&return(N))) \\ M. F. Hasler, Feb 22 2021

Formula

a(n) = concatenate( n, ..., A084559(n)). - M. F. Hasler, Feb 22 2021

Extensions

Added escape clause to definition. - N. J. A. Sloane, Feb 22 2021

A341701 a(n) = largest m > 0 such that the decimal concatenation n||n-1||n-2||...||m is prime, or -1 if no such prime exists.

Original entry on oeis.org

-1, -1, 2, 3, 3, 5, -1, 7, -1, -1, 9, 11, -1, 13, -1, -1, -1, 17, -1, 19, -1, -1, 21, 23, 23, 13, -1, 23, -1, 29, -1, 31, -1, -1, 33, -1, -1, 37, -1, -1, -1, 41, 41, 43, -1, -1, 39, 47, 41, -1, -1, 47, 37, 53, -1, 43, 47, -1, 57, 59, 47, 61, -1, -1, -1, -1, -1
Offset: 0

Views

Author

Chai Wah Wu, Feb 23 2021

Keywords

Comments

A variant of A341717. a(82) = 1. Are there other n such that a(n) = 1?
Similar argument as in A341716 shows that if n > 3 and a(n) >= 0, then a(n) is odd, n-a(n) !== 2 (mod 3) and n+a(n) !== 0 (mod 3).

Examples

			a(4) = 3 since 43 is prime, a(25) = 13 since 25242322212019181716151413 is prime.
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    def A341701(n):
        k, m = n, n-1
        while not isprime(k) and m > 0:
            k = int(str(k)+str(m))
            m -= 1
        return m+1 if isprime(k) else -1

Formula

a(p) = p if and only if p is prime.

A341702 a(n) is the smallest k < n such that the decimal concatenation n||n-1||n-2||...||n-k is prime, or -1 if no such prime exists.

Original entry on oeis.org

-1, -1, 0, 0, 1, 0, -1, 0, -1, -1, 1, 0, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, 1, 0, 1, 12, -1, 4, -1, 0, -1, 0, -1, -1, 1, -1, -1, 0, -1, -1, -1, 0, 1, 0, -1, -1, 7, 0, 7, -1, -1, 4, 15, 0, -1, 12, 9, -1, 1, 0, 13, 0, -1, -1, -1, -1, -1, 0, 57, -1, 1, 0, -1, 0
Offset: 0

Views

Author

Chai Wah Wu, Feb 23 2021

Keywords

Comments

A variation of A341716. a(n) = n-1 for n = 82. Are there other n such that a(n) = n-1?
Similar argument as in A341716 shows that if n > 3 and a(n) >= 0, then n-a(n) is odd, a(n) !== 2 (mod 3) and 2n-a(n) !== 0 (mod 3).

Examples

			a(10) = 1 since 109 is prime. a(22) = 1 since 2221 is prime.
		

Crossrefs

Programs

  • Maple
    tcat:= proc(x,y) x*10^(1+ilog10(y))+y end proc:
    f:= proc(n) local x,k;
      x:= n;
      for k from 0 to n-1 do
        if isprime(x) then return k fi;
        x:= tcat(x,n-k-1)
      od;
      -1
    end proc:
    map(f, [$0..100]); # Robert Israel, Mar 02 2022
  • PARI
    a(n) = my(k=0, s=Str(n)); while (!isprime(eval(s)), k++; n--; if (k>=n, return(-1)); s = concat(s, Str(n-k))); return(k); \\ Michel Marcus, Mar 02 2022
  • Python
    from sympy import isprime
    def A341702(n):
        k, m = n, n-1
        while not isprime(k) and m > 0:
            k = int(str(k)+str(m))
            m -= 1
        return n-m-1 if isprime(k) else -1
    

Formula

a(n) = n-A341701(n).
a(p) = 0 if and only if p is prime.

A341931 a(n) = smallest m > 0 such that the decimal concatenation n||n-1||n-2||...||m is prime, or -1 if no such prime exists.

Original entry on oeis.org

-1, -1, 2, 3, 3, 5, -1, 3, -1, -1, 7, 11, -1, 13, -1, -1, -1, 17, -1, 19, -1, -1, 19, 23, 23, 13, -1, 23, -1, 29, -1, 31, -1, -1, 33, -1, -1, 37, -1, -1, -1, 41, 41, 43, -1, -1, 3, 47, 17, -1, -1, 47, 37, 41, -1, 27, 47, -1, 57, 59, 47, 61, -1, -1, -1, -1, -1
Offset: 0

Views

Author

Chai Wah Wu, Feb 23 2021

Keywords

Comments

a(n) <= A341701(n). a(82) = 1, are there any other n such that a(n) = 1?
Primes p such that a(p) < p: 7, 53, 73, 79, 89, 103, ...
n such that a(n) < A341701(n): 7, 10, 22, 46, 48, 53, 55, 73, ...
Similar argument as in A341716 shows that if n > 3 and a(n) >= 0, then a(n) is odd, n-a(n) !== 2 (mod 3) and n+a(n) !== 0 (mod 3).

Examples

			a(7) = 3 since 76543 is prime and 765432, 7654321 are not. a(10) = 7 since 10987 is prime.
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    def A341931(n):
        k, m, r = n, n-1, n if isprime(n) else -1
        while m > 0:
            k = int(str(k)+str(m))
            if isprime(k):
                r = m
            m -= 1
        return r

A341932 a(n) = largest k < n such that the decimal concatenation n||n-1||n-2||...||n-k is prime, or -1 if no such prime exists.

Original entry on oeis.org

-1, -1, 0, 0, 1, 0, -1, 4, -1, -1, 3, 0, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, 3, 0, 1, 12, -1, 4, -1, 0, -1, 0, -1, -1, 1, -1, -1, 0, -1, -1, -1, 0, 1, 0, -1, -1, 43, 0, 31, -1, -1, 4, 15, 12, -1, 28, 9, -1, 1, 0, 13, 0, -1, -1, -1, -1, -1, 0, 57, -1, 1, 0, -1
Offset: 0

Views

Author

Chai Wah Wu, Feb 23 2021

Keywords

Comments

a(82) = 81, are there any other n such that a(n) = n-1?
Primes p such that a(p) > 0: 7, 53, 73, 79, 89, 103, ...
n such that a(n) > A341702(n): 7, 10, 22, 46, 48, 53, 55, 73, ...
Similar argument as in A341716 shows that if n > 3 and a(n) >= 0, then n-a(n) is odd, a(n) !== 2 (mod 3) and 2n-a(n) !== 0 (mod 3).

Examples

			a(22) = 3 since 22212019 is prime.
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    def A341932(n):
        k, m, r = n, n-1, 0 if isprime(n) else -1
        while m > 0:
            k = int(str(k)+str(m))
            if isprime(k):
                r = n-m
            m -= 1
        return r

Formula

a(n) = n-A341931(n) >= A341702(n).

A341720 a(n) = smallest k > 0 such that the decimal concatenation n||n+1||n+2||...||n+k is prime, or -1 if no such prime exists.

Original entry on oeis.org

1, 16, 3, 12, 1, 6, 1, 178
Offset: 2

Views

Author

N. J. A. Sloane, Feb 24 2021

Keywords

Comments

If they exist, a(10) > 22496; a(21)-a(22) > 17510; a(24) > 15696; a(27) > 13641; a(29)-a(32), a(40), a(41), a(43), a(45), a(46)-a(48) > 7000; a(52) > 16359; a(54) > 16458; a(55) > 14261; a(60) > 19920; a(61) > 9029; a(11) = 298, a(12) = 1, a(13) = 7284, a(14) = 3, a(15) = 4, a(16) = 27, a(17) = 22, a(18) = 3589, a(19) = 1452, a(20) = 3, a(23) = 18, a(25) = 24, a(26) = 121, a(28) = 45, a(33) = 70, a(34) = 3, a(35) = 568, a(36) = 1, a(37) = 6, a(38) = 19, a(39) = 4, a(42) = 1, a(44) = 7, a(49) = 192, a(50) = 1, a(51) = 7228, a(53) = 430, a(56) = 1, a(57) = 4, a(58) = 3, a(59) = 18. - J.W.L. (Jan) Eerland, Feb 24 2023
If it exists, a(10) > 50000. - Michael S. Branicky, Aug 29 2024

Crossrefs

If k=0 is allowed we get the sequences [A341715, A341716, A341717], but if k must be at least 1 we get [A140793, the present sequence, A084559].

Programs

  • Mathematica
    Table[k=1;Monitor[Parallelize[While[True,If[PrimeQ[ToExpression[StringJoin[ToString/@Table[n+a,{a,0,k}]]]],Break[]];k++];k],k],{n,2,9}] (* J.W.L. (Jan) Eerland, Dec 22 2022 *)
  • PARI
    f(n,k) = my(s=Str(n)); for(i=1, k, s=concat(s, n+i)); eval(s);
    a(n) = my(k=1); while(!ispseudoprime(f(n,k)), k++); k; \\ Michel Marcus, Dec 22 2022
Showing 1-9 of 9 results.