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.

Previous Showing 11-20 of 31 results. Next

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.

A084551 Primes which are a concatenation of five consecutive numbers.

Original entry on oeis.org

1516171819, 3940414243, 5758596061, 6566676869, 7778798081, 8384858687, 8990919293, 129130131132133, 153154155156157, 197198199200201, 213214215216217, 239240241242243, 269270271272273, 387388389390391, 399400401402403, 443444445446447, 459460461462463
Offset: 1

Views

Author

Zak Seidov, Jun 27 2003

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Table[FromDigits[Flatten[IntegerDigits[n+Range[-2,2]]]],{n,2,500}],PrimeQ] (* Jayanta Basu, May 24 2013 *)
    Select[FromDigits[Flatten[IntegerDigits[#]]]&/@Partition[Range[600],5,1], PrimeQ] (* Harvey P. Dale, Nov 11 2014 *)

A210512 Primes formed by concatenating k, k and 3 for k >= 1.

Original entry on oeis.org

113, 223, 443, 773, 883, 10103, 11113, 14143, 25253, 26263, 28283, 32323, 35353, 41413, 50503, 61613, 68683, 71713, 77773, 80803, 83833, 85853, 88883, 97973, 1001003, 1011013, 1101103, 1131133, 1161163, 1181183, 1221223, 1241243, 1281283, 1331333, 1361363, 1391393
Offset: 1

Views

Author

Abhiram R Devesh, Jan 26 2013

Keywords

Comments

This sequence is similar to A030458, A052089 and A210511.
k must not be a multiple of 3, otherwise the concatenation of k, k and 3 will also be a multiple of 3 and therefore not prime. This is a necessary but not sufficient condition.
Some of the terms can be found with this simple process: 5 - 3 = 2 = 1 + 1 giving 113; 7 - 3 = 4 = 2 + 2 giving 223; 11 - 3 = 8 = 4 + 4 giving 443; 17 - 3 = 14 = 7 + 7 giving 773; 19 - 3 = 16 = 8 + 8 giving 883. - J. M. Bergot, Jul 25 2022

Crossrefs

Programs

  • Magma
    [nn3: n in [1..140] | IsPrime(nn3) where nn3 is Seqint([3] cat Intseq(n) cat Intseq(n))]; // Bruno Berselli, Jan 30 2013
  • Mathematica
    Select[Table[FromDigits[Flatten[{IntegerDigits[n], IntegerDigits[n], {3}}]], {n, 100}], PrimeQ] (* Alonso del Arte, Jan 27 2013 *)
  • Python
    import numpy as np
    from functools import reduce
    def factors(n):
        return reduce(list._add_, ([i, n//i] for i in range(1, int(n**0.5) +1) if n % i == 0))
    for i in range(1, 1000):
        p1=int(str(i)+str(i)+"3")
        if len(factors(p1))<3:
            print(p1, end=',')
    
  • Python
    from sympy import isprime
    def xf(n): return int(str(n)*2+'3')
    def ok(n): return isprime(xf(n))
    print(list(map(xf, filter(ok, range(1, 140))))) # Michael S. Branicky, May 21 2021
    

A210513 Primes formed by concatenating k, k, and 7.

Original entry on oeis.org

227, 337, 557, 887, 997, 11117, 24247, 26267, 27277, 29297, 30307, 32327, 39397, 48487, 51517, 54547, 60607, 62627, 65657, 68687, 69697, 72727, 74747, 78787, 81817, 87877, 89897, 90907, 92927, 93937, 95957, 101710177, 101910197, 103110317, 103410347, 103810387
Offset: 1

Views

Author

Abhiram R Devesh, Jan 26 2013

Keywords

Comments

This sequence is similar to A030458, A052089, and A092994.
Base considered is 10.
Observations:
- k cannot be a multiple of 7.
- k cannot have a digital root 7 as the sum of the digits would be divisible by 3.
- There is no k between 100 and 1000 that can form a prime number of this form after 95957 the next prime is 101710177.
- k cannot have a digital root equal to 1 or 4, because then in the concatenation it contributes 2 or 8 to the digital root of the number, and that number is then divisible by 3.

Examples

			For k = 2, a(1) = 227.
For k = 3, a(2) = 337.
For k = 5, a(3) = 557.
For k = 8, a(4) = 887.
For k = 9, a(5) = 997.
		

Crossrefs

Programs

  • Mathematica
    Select[Table[FromDigits[Flatten[{IntegerDigits[n], IntegerDigits[n], {7}}]], {n, 100}], PrimeQ] (* Alonso del Arte, Feb 01 2013 *)
  • Python
    import numpy as np
    from functools import reduce
    def factors(n):
        return reduce(list._add_, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))
    for i in range(1, 2000):
        p1=int(str(i)+str(i)+"7")
        if len(factors(p1))<3:
            print(p1, end=',')
    
  • Python
    from sympy import isprime
    from itertools import count, islice
    def agen(): yield from filter(isprime, (int(str(k)+str(k)+'7') for k in count(1)))
    print(list(islice(agen(), 36))) # Michael S. Branicky, Jul 26 2022

Extensions

a(34) and beyond from Michael S. Branicky, Jul 26 2022

A210514 Prime numbers generated by concatenating k, k, and 9.

Original entry on oeis.org

229, 449, 11119, 14149, 22229, 28289, 31319, 37379, 44449, 49499, 52529, 56569, 67679, 70709, 71719, 80809, 86869, 89899, 94949, 95959, 1061069, 1101109, 1131139, 1151159, 1161169, 1191199, 1241249, 1251259, 1331339, 1401409, 1431439, 1481489, 1571579, 1601609
Offset: 1

Views

Author

Abhiram R Devesh, Jan 26 2013

Keywords

Comments

This series is similar to A030458 and A052089.
Base considered is 10.

Examples

			For k=2, a(1)= 229.
For k=4, a(2)= 449.
For k=11, a(3)= 11119.
For k=14, a(4)= 14149.
		

Crossrefs

Programs

  • Mathematica
    Select[Table[FromDigits[Flatten[Join[IntegerDigits/@{n,n},{9}]]],{n,200}],PrimeQ] (* Harvey P. Dale, Apr 23 2015 *)
  • Python
    import numpy as np
    from functools import reduce
    def factors(n):
        return reduce(list._add_, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))
    for i in range(1, 2000):
        p1=int(str(i)+str(i)+"1")
        if len(factors(p1))<3:
            print(p1, end=',')
    
  • Python
    from sympy import isprime
    from itertools import count, islice
    def agen(): yield from filter(isprime, (int(str(k)+str(k)+'9') for k in count(1)))
    print(list(islice(agen(), 34))) # Michael S. Branicky, Jul 26 2022

Extensions

a(27) and beyond from Michael S. Branicky, Jul 26 2022

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

A085720 Start of a run of 7 successive numbers which when concatenated form a prime.

Original entry on oeis.org

7, 37, 157, 185, 187, 271, 301, 355, 475, 485, 523, 533, 577, 611, 653, 661, 667, 731, 733, 755, 761, 791, 853, 911, 913, 937, 983, 1085, 1111, 1187, 1205, 1253, 1397, 1417, 1585, 1631, 1655, 1685, 1697, 1711, 1723, 1841, 1907, 1975, 2035, 2077, 2105, 2185
Offset: 1

Views

Author

Zak Seidov, Jun 27 2003

Keywords

Comments

Concatenation of three and six successive numbers are always composite.
Primes as concatenation of two, four and five successive numbers are in A030458, A030471, A052087, A052088, A052089.

Crossrefs

Programs

  • Mathematica
    f[n_] := FromDigits[ Flatten[ Table[ IntegerDigits[i], {i, n, n + 6}]]]; Select[ Range[2190], PrimeQ[ f[ # ]] & ]
    Select[Range[2500],PrimeQ[FromDigits[Flatten[IntegerDigits/@Range[#,#+6]]]]&] (* Harvey P. Dale, Aug 15 2021 *)

Extensions

Edited by Robert G. Wilson v, Jun 28 2003
Edited by Charles R Greathouse IV, Apr 24 2010

A104323 Primes which are the reverse concatenation of four consecutive numbers.

Original entry on oeis.org

10987, 22212019, 86858483, 94939291, 100999897, 106105104103, 112111110109, 122121120119, 124123122121, 146145144143, 184183182181, 226225224223, 232231230229, 244243242241, 274273272271, 332331330329, 362361360359
Offset: 1

Views

Author

Shyam Sunder Gupta, Apr 17 2005

Keywords

Examples

			The first term is 10987 which is a prime and is the reverse concatenation of 7,8,9 and 10 which are four consecutive numbers.
		

Crossrefs

Cf. A052089.

Programs

  • Mathematica
    Select[Table[FromDigits[Flatten[IntegerDigits/@Range[n,n-3,-1]]],{n,4,400}],PrimeQ] (* Harvey P. Dale, Aug 02 2021 *)
  • PARI
    forstep(n=10,400,2,isprime(t=eval(Str(n,n-1,n-2,n-3)))&print1(t",")) \\ Zak Seidov, May 08 2013

A279213 Primes formed by concatenating n with n-3.

Original entry on oeis.org

41, 107, 1613, 2017, 3229, 4441, 4643, 5653, 7673, 9491, 106103, 116113, 124121, 130127, 136133, 170167, 172169, 182179, 184181, 196193, 206203, 212209, 214211, 220217, 224221, 230227, 272269, 274271, 280277, 302299, 304301, 320317, 322319, 326323, 334331
Offset: 1

Views

Author

Vincenzo Librandi, Dec 08 2016

Keywords

Examples

			For n = 16, n-3 = 13. Concatenating 16 and 13 gives 1613 which is a prime. So, 1613 is in the sequence. - _Indranil Ghosh_, Jan 23 2017
		

Crossrefs

Programs

  • Magma
    [m: n in [4..400 by 2] | IsPrime(m) where m is Seqint(Intseq(n-3) cat Intseq(n))];
    
  • Mathematica
    Select[Table[FromDigits[Join[Flatten[IntegerDigits[{n, n -3}]]]], {n, 400}], PrimeQ]
  • PARI
    terms(n) = my(i=0, k=3); while(i < n, my(x=eval(Str(k, k-3))); if(ispseudoprime(x), print1(x, ", "); i++); k++)
    /* Print initial 35 terms as follows: */
    terms(35) \\ Felix Fröhlich, Jan 23 2017
  • Python
    from sympy import isprime
    i=4
    j=1
    while j<=10000:
        if isprime(int(str(i)+str(i-3)))==True:
            print(str(j)+" "+str(i)+str(i-3))
            j+=1
        i+=1 # Indranil Ghosh, Jan 23 2017
    
Previous Showing 11-20 of 31 results. Next