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

A127423 a(1) = 1; for n > 1, a(n) = n concatenated with n - 1.

Original entry on oeis.org

1, 21, 32, 43, 54, 65, 76, 87, 98, 109, 1110, 1211, 1312, 1413, 1514, 1615, 1716, 1817, 1918, 2019, 2120, 2221, 2322, 2423, 2524, 2625, 2726, 2827, 2928, 3029, 3130, 3231, 3332, 3433, 3534, 3635, 3736, 3837, 3938, 4039, 4140, 4241, 4342, 4443, 4544, 4645
Offset: 1

Views

Author

Artur Jasinski, Jan 14 2007

Keywords

Comments

a(1) could also have been defined to be 10. In that case the initial terms would be 10, 21, 32, 43, 54, 65, 76, 87, 98, 109, 1110, 1211, 1312, 1413, 1514, 1615, 1716, 1817, 1918, 2019, 2120, 2221, 2322, 2423, 2524, 2625, 2726, 2827, 2928, 3029, 3130, 3231, 3332, 3433, ... (Comment added in case someone is searching for that sequence.) - N. J. A. Sloane, Aug 11 2018
A010051(a(A054211(n))) = 1. - Reinhard Zumkeller, Jun 27 2015

Examples

			a(12) = 1211 because 12 and 11 are two consecutive decreasing numbers.
		

Crossrefs

Programs

  • Haskell
    a127423 n = a127423_list !! (n-1)
    a127423_list = 1 : map read (zipWith (++) (tail iss) iss) :: [Integer]
                       where iss = map show [1..]
    -- Reinhard Zumkeller, Oct 07 2014
    
  • Magma
    [Seqint(Intseq(n) cat Intseq(n+1)): n in [0..50]]; // Vincenzo Librandi, Nov 08 2016
    
  • Maple
    c2:=proc(x,y) local s: s:=proc(m) nops(convert(m,base,10)) end: x*10^s(y)+y: end: seq(c2(n,n-1),n=1..53); # Emeric Deutsch, Mar 07 2007
  • Mathematica
    Join[{1}, nxt[n_] := Module[{idn = IntegerDigits[n + 1], idn1 = IntegerDigits[n]}, FromDigits[Join[idn, idn1]]]; Array[nxt, 70]] (* Vincenzo Librandi, Nov 08 2016 *)
    nxt[{n_, a_}] := {n + 1, (n + 1) * 10^IntegerLength[n] + n}; NestList[nxt, {1, 1}, 50][[All, 2]] (* Harvey P. Dale, Jan 04 2019 *)
  • PARI
    a(n) = if (n==1, 1, eval(Str(n, n-1))); \\ Michel Marcus, Oct 14 2016
    
  • Scala
    val numerStrs = (1 to 50).map(Integer.toString(_)).toList
    val concats = (numerStrs.drop(1)) zip (numerStrs.dropRight(1))
    concats.map(x => Integer.parseInt(x.1 + x._2)) // _Alonso del Arte, Oct 24 2019

Extensions

More terms from Emeric Deutsch, Mar 07 2007

A030457 Numbers k such that k concatenated with k+1 is prime.

Original entry on oeis.org

2, 6, 8, 12, 36, 42, 50, 56, 62, 68, 78, 80, 90, 92, 96, 102, 108, 120, 126, 138, 150, 156, 180, 186, 188, 192, 200, 216, 242, 246, 252, 270, 276, 278, 300, 308, 312, 318, 330, 338, 342, 350, 362, 368, 378, 390, 402, 410, 416, 420, 426, 428, 432
Offset: 1

Views

Author

Keywords

Comments

k is not congruent to 1 (mod 2), 1 (mod 3), or 4 (mod 5). - Charles R Greathouse IV, Apr 16 2012

Examples

			1213 is prime, therefore 12 is a term.
		

Crossrefs

Cf. A010051, A001704, A068700 (subsequence).
Numbers k such that k concatenated with k+m is prime: this sequence (m=1), A032617 (m=2), A032618 (m=3), A032619 (m=4), A032620 (m=5), A032621 (m=6), A032622 (m=7), A032623 (m=8), A032624 (m=9).

Programs

  • Haskell
    a030457 n = a030457_list !! (n-1)
    a030457_list = filter ((== 1) . a010051' . a001704) [1..]
    -- Reinhard Zumkeller, Jun 27 2015, Apr 26 2011
    
  • Magma
    [n: n in [1..500] | IsPrime(Seqint(Intseq(n+1) cat Intseq(n)))]; // Vincenzo Librandi, Jul 23 2016
    
  • Maple
    concat:=proc(a,b) local bb: bb:=nops(convert(b,base,10)): 10^bb*a+b end proc: a:=proc(n) if isprime(concat(n,n+1))=true then n else end if end proc: seq(a(n),n=0..500); # Emeric Deutsch, Nov 23 2007
  • Mathematica
    Select[ Range[500], PrimeQ[ ToExpression[ StringJoin[ ToString[#], ToString[#+1]]]]&] (* Jean-François Alcover, Nov 18 2011 *)
    Select[Range[500],PrimeQ[FromDigits[Join[IntegerDigits[#], IntegerDigits[ #+1]]]]&] (* Harvey P. Dale, Dec 23 2015 *)
    Position[#[[1]]*10^IntegerLength[#[[2]]]+#[[2]]&/@Partition[Range[ 500], 2,1],?PrimeQ]//Flatten (* _Harvey P. Dale, Jul 14 2019 *)
  • PARI
    for(n=1,10^5,if(isprime(eval(concat(Str(n),n+1))),print1(n,", "))); /* Joerg Arndt, Apr 27 2011 */
    
  • Python
    from sympy import isprime
    def ok(n): return isprime(int(str(n)+str(n+1)))
    print([k for k in range(500) if ok(k)]) # Michael S. Branicky, Apr 19 2023

A068700 The concatenation of n with n-1 and n with n+1 both yield primes (twin primes).

Original entry on oeis.org

42, 78, 102, 108, 180, 192, 270, 300, 312, 330, 342, 390, 420, 522, 540, 612, 660, 822, 840, 882, 1002, 1140, 1230, 1272, 1482, 1542, 1632, 1770, 2100, 2190, 2682, 2742, 3072, 3198, 3408, 3642, 3828, 4242, 4452, 4572, 4740, 4788, 4998, 5622, 5718, 5832
Offset: 1

Views

Author

Amarnath Murthy, Mar 04 2002

Keywords

Comments

All terms are congruent to {0, 12, 18} mod 30. - Zak Seidov, Oct 24 2014
a(n) = 2 * A102478(n). - Reinhard Zumkeller, Jun 27 2015

Examples

			42 is a member as 4241 as well as 4243 are primes.
		

Crossrefs

Common terms of A030458 and A052089.
Intersection of A030457 and A054211; A102478.

Programs

  • Haskell
    import Data.List.Ordered (isect)
    a068700 n = a068700_list !! (n-1)
    a068700_list = isect a030457_list a054211_list
    -- Reinhard Zumkeller, Jun 27 2015
  • Maple
    filter:= proc(n)
    local d;
    d:= ilog10(n)+1;
    isprime(n*10^d+n-1) and isprime(n*10^d+n+1)
    end proc:
    select(filter, [$1..10^5]); # Robert Israel, Oct 24 2014
  • Mathematica
    d[n_]:=IntegerDigits[n]; conQ[n_]:=And@@PrimeQ[FromDigits/@{Join[d[n],d[n+1]],Join[d[n],d[n-1]]}]; Select[Range[5850],conQ[#] &] (* Jayanta Basu, May 21 2013 *)
  • PARI
    for(n=2,200, if(isprime(n*10^ceil(log(n-1)/log(10))+n-1)*isprime(n*10^ceil(log(n+1)/log(10))+n+1)==1,print1(n,",")))
    

Extensions

More terms from Benoit Cloitre, Mar 09 2002

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.

A089432 Numbers n such that n concatenated with floor(n/2) is prime.

Original entry on oeis.org

3, 7, 15, 19, 23, 27, 35, 39, 47, 55, 67, 75, 95, 99, 107, 119, 127, 135, 163, 179, 187, 195, 227, 235, 239, 243, 255, 267, 303, 319, 327, 347, 379, 407, 427, 443, 455, 459, 463, 479, 523, 539, 547, 555, 583, 607, 619, 635, 663, 667, 683, 687, 695, 715, 723
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 28 2003

Keywords

Comments

All terms are odd.

Crossrefs

Cf. A054211.
Showing 1-5 of 5 results.