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-10 of 15 results. Next

A066492 a(n) = A056524(n)/11.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 91, 101, 111, 121, 131, 141, 151, 161, 171, 181, 182, 192, 202, 212, 222, 232, 242, 252, 262, 272, 273, 283, 293, 303, 313, 323, 333, 343, 353, 363, 364, 374, 384, 394, 404, 414, 424, 434, 444, 454, 455, 465, 475, 485, 495, 505, 515
Offset: 1

Views

Author

Vladeta Jovovic, Jan 09 2002

Keywords

Crossrefs

Extensions

Edited by N. J. A. Sloane at the suggestion of Artur Jasinski, Aug 24 2007

A002113 Palindromes in base 10.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 505, 515
Offset: 1

Views

Author

Keywords

Comments

n is a palindrome (i.e., a(k) = n for some k) if and only if n = A004086(n). - Reinhard Zumkeller, Mar 10 2002
It seems that if n*reversal(n) is in the sequence then n = 3 or all digits of n are less than 3. - Farideh Firoozbakht, Nov 02 2014
The position of a palindrome within the sequence can be determined almost without calculation: If the palindrome has an even number of digits, prepend a 1 to the front half of the palindrome's digits. If the number of digits is odd, prepend the value of front digit + 1 to the digits from position 2 ... central digit. Examples: 98766789 = a(19876), 515 = a(61), 8206028 = a(9206), 9230329 = a(10230). - Hugo Pfoertner, Aug 14 2015
This sequence is an additive basis of order at most 49, see Banks link. - Charles R Greathouse IV, Aug 23 2015
The order has been reduced from 49 to 3; see the Cilleruelo-Luca and Cilleruelo-Luca-Baxter links. - Jonathan Sondow, Nov 27 2017
See A262038 for the "next palindrome" and A261423 for the "preceding palindrome" functions. - M. F. Hasler, Sep 09 2015
The number of palindromes with d digits is 10 if d = 1, and otherwise it is 9 * 10^(floor((d - 1)/2)). - N. J. A. Sloane, Dec 06 2015
Sequence A033665 tells how many iterations of the Reverse-then-add function A056964 are needed to reach a palindrome; numbers for which this will never happen are Lychrel numbers (A088753) or rather Kin numbers (A023108). - M. F. Hasler, Apr 13 2019
This sequence is an additive basis of order 3, see Cilleruelo, Luca, & Baxter and Sigg. - Charles R Greathouse IV, Apr 08 2025

References

  • Karl G. Kröber, "Palindrome, Perioden und Chaoten: 66 Streifzüge durch die palindromischen Gefilde" (1997, Deutsch-Taschenbücher; Bd. 99) ISBN 3-8171-1522-9.
  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 71.
  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, pages 50-52.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 120.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Subsequence of A061917 and A221221.
A110745 is a subsequence.
Union of A056524 and A056525.
Palindromes in bases 2 through 11: A006995 and A057148, A014190 and A118594, A014192 and A118595, A029952 and A118596, A029953 and A118597, A029954 and A118598, A029803 and A118599, A029955 and A118600, this sequence, A029956. Also A262065 (base 60), A262069 (subsequence).
Palindromic primes: A002385. Palindromic nonprimes: A032350.
Palindromic-pi: A136687.
Cf. A029742 (complement), A086862 (first differences).
Palindromic floor function: A261423, also A261424. Palindromic ceiling: A262038.
Cf. A004086 (read n backwards), A064834, A118031, A136522 (characteristic function), A178788.
Ways to write n as a sum of three palindromes: A261132, A261422.
Minimal number of palindromes that add to n using greedy algorithm: A088601.
Minimal number of palindromes that add to n: A261675.

Programs

  • GAP
    Filtered([0..550],n->ListOfDigits(n)=Reversed(ListOfDigits(n))); # Muniru A Asiru, Mar 08 2019
    
  • Haskell
    a002113 n = a002113_list !! (n-1)
      a002113_list = filter ((== 1) . a136522) [1..] -- Reinhard Zumkeller, Oct 09 2011
    
  • Haskell
    import Data.List.Ordered (union)
      a002113_list = union a056524_list a056525_list -- Reinhard Zumkeller, Jul 29 2015, Dec 28 2011
    
  • Magma
    [n: n in [0..600] | Intseq(n, 10) eq Reverse(Intseq(n, 10))]; // Vincenzo Librandi, Nov 03 2014
    
  • Maple
    read transforms; t0:=[]; for n from 0 to 2000 do if digrev(n) = n then t0:=[op(t0),n]; fi; od: t0;
    # Alternatively, to get all palindromes with <= N digits in the list "Res":
    N:=5;
    Res:= $0..9:
    for d from 2 to N do
      if d::even then
        m:= d/2;
        Res:= Res, seq(n*10^m + digrev(n),n=10^(m-1)..10^m-1);
      else
        m:= (d-1)/2;
        Res:= Res, seq(seq(n*10^(m+1)+y*10^m+digrev(n),y=0..9),n=10^(m-1)..10^m-1);
      fi
    od: Res:=[Res]: # Robert Israel, Aug 10 2014
    # A variant: Gets all base-10 palindromes with exactly d digits, in the list "Res"
    d:=4:
    if d=1 then Res:= [$0..9]:
    elif d::even then
        m:= d/2:
        Res:= [seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1)]:
    else
        m:= (d-1)/2:
        Res:= [seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1)]:
    fi:
    Res; # N. J. A. Sloane, Oct 18 2015
    isA002113 := proc(n)
        simplify(digrev(n) = n) ;
    end proc: # R. J. Mathar, Sep 09 2015
  • Mathematica
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]]; (* then to generate any base-b sequence for 1 < b < 37, replace the 10 in the following instruction with b: *) Select[Range[0, 1000], palQ[#, 10] &]
    base10Pals = {0}; r = 2; Do[Do[AppendTo[base10Pals, n * 10^(IntegerLength[n] - 1) + FromDigits@Rest@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}]; Do[AppendTo[base10Pals, n * 10^IntegerLength[n] + FromDigits@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}], {e, r}]; base10Pals (* Arkadiusz Wesolowski, May 04 2012 *)
    nthPalindromeBase[n_, b_] := Block[{q = n + 1 - b^Floor[Log[b, n + 1 - b^Floor[Log[b, n/b]]]], c = Sum[Floor[Floor[n/((b + 1) b^(k - 1) - 1)]/(Floor[n/((b + 1) b^(k - 1) - 1)] - 1/b)] - Floor[Floor[n/(2 b^k - 1)]/(Floor[n/(2 b^k - 1)] - 1/ b)], {k, Floor[Log[b, n]]}]}, Mod[q, b] (b + 1)^c * b^Floor[Log[b, q]] + Sum[Floor[Mod[q, b^(k + 1)]/b^k] b^(Floor[Log[b, q]] - k) (b^(2 k + c) + 1), {k, Floor[Log[b, q]]}]] (* after the work of Eric A. Schmidt, works for all integer bases b > 2 *)
    Array[nthPalindromeBase[#, 10] &, 61, 0] (* please note that Schmidt uses a different, a more natural and intuitive offset, that of a(1) = 1. - Robert G. Wilson v, Sep 22 2014 and modified Nov 28 2014 *)
    Select[Range[10^3], PalindromeQ] (* Michael De Vlieger, Nov 27 2017 *)
    nLP[cn_Integer]:=Module[{s,len,half,left,pal,fdpal},s=IntegerDigits[cn]; len=Length[s]; half=Ceiling[len/2]; left=Take[s,half]; pal=Join[left,Reverse[ Take[left,Floor[len/2]]]]; fdpal=FromDigits[pal]; Which[cn==9,11,fdpal>cn,fdpal,True,left=IntegerDigits[ FromDigits[left]+1]; pal=Join[left,Reverse[Take[left,Floor[len/2]]]]; FromDigits[pal]]]; NestList[nLP,0,100] (* Harvey P. Dale, Dec 10 2024 *)
  • PARI
    is_A002113(n)=Vecrev(n=digits(n))==n \\ M. F. Hasler, Nov 17 2008, updated Apr 26 2014, Jun 19 2018
    
  • PARI
    is(n)=n=digits(n);for(i=1,#n\2,if(n[i]!=n[#n+1-i],return(0))); 1 \\ Charles R Greathouse IV, Jan 04 2013
    
  • PARI
    a(n)={my(d,i,r);r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11));n=n-10^(#digits(n\11));d=digits(n);for(i=1,#d,r[i]=d[i];r[#r+1-i]=d[i]);sum(i=1,#r,10^(#r-i)*r[i])} \\ David A. Corneth, Jun 06 2014
    
  • PARI
    \\ recursive--feed an element a(n) and it gives a(n+1)
    nxt(n)=my(d=digits(n));i=(#d+1)\2;while(i&&d[i]==9,d[i]=0;d[#d+1-i]=0;i--);if(i,d[i]++;d[#d+1-i]=d[i],d=vector(#d+1);d[1]=d[#d]=1);sum(i=1,#d,10^(#d-i)*d[i]) \\ David A. Corneth, Jun 06 2014
    
  • PARI
    \\ feed a(n), returns n.
    inv(n)={my(d=digits(n));q=ceil(#d/2);sum(i=1,q,10^(q-i)*d[i])+10^floor(#d/2)} \\ David A. Corneth, Jun 18 2014
    
  • PARI
    inv_A002113(P)={P\(P=10^(logint(P+!P,10)\/2))+P} \\ index n of palindrome P = a(n), much faster than above: no sum is needed. - M. F. Hasler, Sep 09 2018
    
  • PARI
    A002113(n,L=logint(n,10))=(n-=L=10^max(L-(n<11*10^(L-1)),0))*L+fromdigits(Vecrev(digits(if(nM. F. Hasler, Sep 11 2018
    
  • Python
    # edited by M. F. Hasler, Jun 19 2018
    def A002113_list(nMax):
      mlist=[]
      for n in range(nMax+1):
         mstr=str(n)
         if mstr==mstr[::-1]:
            mlist.append(n)
      return mlist # Bill McEachen, Dec 17 2010
    
  • Python
    from itertools import chain
    A002113 = sorted(chain(map(lambda x:int(str(x)+str(x)[::-1]),range(1,10**3)),map(lambda x:int(str(x)+str(x)[-2::-1]), range(10**3)))) # Chai Wah Wu, Aug 09 2014
    
  • Python
    from itertools import chain, count
    A002113 = chain(k for k in count(0) if str(k) == str(k)[::-1])
    print([next(A002113) for k in range(60)]) # Jan P. Hartkopf, Apr 10 2021
    
  • Python
    is_A002113 = lambda n: (s:=str(n))[::-1]==s # M. F. Hasler, May 23 2024
    
  • Python
    from math import log10, floor
    def A002113(n):
      if n < 2: return 0
      P = 10**floor(log10(n//2)); M = 11*P
      s = str(n - (P if n < M else M-P))
      return int(s + s[-2 if n < M else -1::-1]) # M. F. Hasler, Jun 06 2024
    
  • SageMath
    [n for n in (0..515) if Word(n.digits()).is_palindrome()] # Peter Luschny, Sep 13 2018
    
  • Scala
    def palQ(n: Int, b: Int = 10): Boolean = n - Integer.parseInt(n.toString.reverse) == 0
    (0 to 999).filter(palQ()) // _Alonso del Arte, Nov 10 2019

Formula

A136522(a(n)) = 1.
A178788(a(n)) = 0 for n > 9. - Reinhard Zumkeller, Jun 30 2010
A064834(a(n)) = 0. - Reinhard Zumkeller, Sep 18 2013
a(n+1) = A262038(a(n)+1). - M. F. Hasler, Sep 09 2015
Sum_{n>=2} 1/a(n) = A118031. - Amiram Eldar, Oct 17 2020
a(n) = (floor(d(n)/(c(n)*9 + 1)))*10^A055642(d(n)) + A004086(d(n)) where b(n, k) = ceiling(log((n + 1)/k)/log(10)), c(n) = b(n, 2) - b(n, 11) and d(n) = (n - A086573(b(n*(2 - c(n)), 2) - 1)/2 - 1). - Alan Michael Gómez Calderón, Mar 11 2025

A020338 Doublets: base-10 representation is the juxtaposition of two identical strings.

Original entry on oeis.org

11, 22, 33, 44, 55, 66, 77, 88, 99, 1010, 1111, 1212, 1313, 1414, 1515, 1616, 1717, 1818, 1919, 2020, 2121, 2222, 2323, 2424, 2525, 2626, 2727, 2828, 2929, 3030, 3131, 3232, 3333, 3434, 3535, 3636, 3737, 3838, 3939, 4040, 4141, 4242, 4343, 4444, 4545, 4646
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. concatenation of n and k*n: this sequence (k=1), A019550 (k=2), A019551 (k=3), A019552 (k=4), A019553 (k=5), A009440 (k=6), A009441 (k=7), A009470 (k=8), A009474 (k=9).

Programs

  • GAP
    Flat(List([1..2],d->List([10^(d-1)..10^d-1],n->(10^d+1)*n))); # Muniru A Asiru, Mar 31 2018
  • Haskell
    a020338 n = read (ns ++ ns) :: Integer  where ns = show n
    -- Reinhard Zumkeller, Jun 07 2015
    
  • Magma
    [Seqint(Intseq(n) cat Intseq(n)): n in [1..46]]; // Bruno Berselli, Mar 20 2013
    
  • Maple
    seq(seq((10^d+1)*n, n = 10^(d-1)..10^d-1),d=1..3); # Robert Israel, Jan 02 2015
  • Mathematica
    nxt[n_]:=Module[{idn=IntegerDigits[n], idn1=IntegerDigits[n]}, FromDigits[Join[idn, idn1]]];Array[nxt, 100] (* Vincenzo Librandi, Feb 04 2014 *)
  • PARI
    a(n) = eval(Str(n,n)); \\ Michel Marcus, Sep 10 2015
    
  • Sage
    [int(str(n)+str(n)) for n in range(1,47)] # Danny Rorabaugh, Oct 10 2015
    

Formula

a(n) = n*10^(A004216(n)+1) + n. - Reinhard Zumkeller, Aug 11 2007
G.f.: 11*x/(1-x)^2 - Sum_{d >= 1} 9*x^(10^d)*(100^d*x-10^d*x-100^d)/(1-x)^2. - Robert Israel, Jan 02 2015
a(n) = n || n. (Where "||" denotes "concatenate". See link "Concatenation".) - Halfdan Skjerning, Apr 01 2018

A056525 Palindromes with odd number of digits.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 505, 515, 525, 535, 545, 555, 565
Offset: 1

Views

Author

Henry Bottomley, Jun 16 2000

Keywords

Comments

Concatenation of all but final digits of n with reverse of n (keeping leading zeros in the reverse)
A178788(a(n)) = 0 for n > 9. [From Reinhard Zumkeller, Jun 30 2010]

Crossrefs

Programs

  • Haskell
    a056525 n = a056525_list !! (n-1)
    a056525_list = [1..9] ++ [read (ns ++ [z] ++ reverse ns) |
                    n <- [1..], let ns = show n, z <- "0123456789"]
    -- Reinhard Zumkeller, Dec 28 2011
  • Mathematica
    Join[Range[9],Table[FromDigits[Join[x=IntegerDigits[n],Reverse[Drop[x,-1]]]],{n,10,56}]] (* Jayanta Basu, May 29 2013 *)
    Select[Flatten[Table[Range[10^n,10^(n+1)-1],{n,0,2,2}]],PalindromeQ] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 21 2020 *)

Formula

a(n) = floor[n/10]*10^A055642(n)+A004086(n)

A067087 Concatenation of n-th prime and its reverse.

Original entry on oeis.org

22, 33, 55, 77, 1111, 1331, 1771, 1991, 2332, 2992, 3113, 3773, 4114, 4334, 4774, 5335, 5995, 6116, 6776, 7117, 7337, 7997, 8338, 8998, 9779, 101101, 103301, 107701, 109901, 113311, 127721, 131131, 137731, 139931, 149941, 151151, 157751
Offset: 1

Views

Author

Amarnath Murthy, Jan 07 2002

Keywords

Comments

Every term of the sequence is divisible by 11.

Crossrefs

Cf. A056524.

Programs

  • Mathematica
    Table[ ToExpression[ StringJoin[ ToString[Prime[n]], StringReverse[ ToString[ Prime[n]]]]], {n, 1, 40} ]
    #*10^IntegerLength[#]+IntegerReverse[#]&/@Prime[Range[50]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 11 2017 *)
  • PARI
    a(n) = { my(d=digits(prime(n))); fromdigits(concat(d,Vecrev(d))) } \\ Harry J. Smith, May 13 2010

Formula

a(n) = A056524(prime(n)). - Andrew Howroyd, Dec 07 2024

Extensions

More terms from Robert G. Wilson v, Jan 09 2002

A110745 a(n) is a number such that if odd positioned digits are deleted one gets n and if even positioned digits are deleted one gets n reversed. Counting is from the LSB side. The position of LSB is one.

Original entry on oeis.org

11, 22, 33, 44, 55, 66, 77, 88, 99, 1001, 1111, 1221, 1331, 1441, 1551, 1661, 1771, 1881, 1991, 2002, 2112, 2222, 2332, 2442, 2552, 2662, 2772, 2882, 2992, 3003, 3113, 3223, 3333, 3443, 3553, 3663, 3773, 3883, 3993, 4004, 4114, 4224, 4334, 4444, 4554
Offset: 1

Views

Author

Amarnath Murthy, Aug 10 2005

Keywords

Comments

Except for initial 0, rearrangement of numbers in A056524. They first differ at a(101) = 110011, while A056524(101) = 101101. If n has digits d_1 d_2 ... d_k, permute them to d_1 d_k d_2 d_{k-1} ... d_{floor(k/2)+1} and use that as index to A056524. - Franklin T. Adams-Watters, Jun 20 2006

Examples

			a(12) = 1221, deleting the LSB and the third digit 2 we get 12, deleting second and fourth digit we get 21.
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a110745 n = read (concat $ transpose [ns, reverse ns]) :: Integer
                where ns = show n
    -- Reinhard Zumkeller, Feb 14 2015

Extensions

More terms from Franklin T. Adams-Watters, Jun 20 2006

A240453 Greatest prime divisors of the palindromes with an even number of digits.

Original entry on oeis.org

11, 11, 11, 11, 11, 11, 11, 11, 11, 13, 101, 37, 11, 131, 47, 151, 23, 19, 181, 13, 11, 101, 53, 37, 29, 11, 11, 131, 17, 13, 283, 293, 101, 313, 19, 37, 11, 353, 11, 13, 17, 11, 197, 101, 23, 53, 31, 37, 227, 13, 31, 19, 97, 11, 101, 103, 11, 107, 109, 13
Offset: 1

Views

Author

Michel Lagneau, Apr 05 2014

Keywords

Comments

Greatest prime divisor of A056524(n), or greatest prime divisor of the concatenation of a number n and reverse(n).
The palindromes with an even number of digits are composite numbers divisible by 11. There are many palindromic prime divisors, such as 11, 101, 131, 151, 181, 313, 353, ..., 30103, ...

Examples

			a(10) = 13 because the concatenation of 10 and 01 is 1001 = 7*11*13 where 13 is the greatest divisor of 1001.
		

Crossrefs

Programs

  • Maple
    with(numtheory):for n from 1 to 100 do:x:=convert(n,base,10):n1:=nops(x): s:=sum('x[i]*10^(n1-i)', 'i'=1..n1):y:=n*10^n1+s:z:=factorset(y):n2:=nops(z):d:=z[n2]:printf(`%d, `,d):od:
  • Mathematica
    d[n_]:=IntegerDigits[n];Table[FactorInteger[FromDigits[Join[x=d[n],Reverse[x]]]][[-1,1]],{n,1,100}]
    FactorInteger[#][[-1,1]]&/@Flatten[Table[Select[Range[10^n,10^(n+1)-1],PalindromeQ],{n,1,3,2}]] (* Harvey P. Dale, Dec 06 2021 *)
  • Python
    from sympy import primefactors
    def a(n): s = str(n); return max(primefactors(int(s + s[::-1])))
    print([a(n) for n in range(1, 61)]) # Michael S. Branicky, Nov 11 2021

Formula

a(n) = A006530(A056524(n)).

A240454 Smallest prime divisors of the palindromes with an even number of digits.

Original entry on oeis.org

11, 2, 3, 2, 5, 2, 7, 2, 3, 7, 11, 3, 11, 11, 3, 11, 7, 3, 11, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 11, 11, 3, 11, 11, 3, 7, 11, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 3, 5, 5, 3, 5, 5, 3, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 7, 11, 3, 11, 11, 3, 11, 7, 3, 11, 2, 2, 2
Offset: 1

Views

Author

Michel Lagneau, Apr 05 2014

Keywords

Comments

a(n) is the smallest prime divisor of A056524(n), or smallest prime divisor of the concatenation of a number n and reverse(n).

Examples

			a(10) = 7 because the concatenation of 10 and 01 is 1001 = 7*11*13 where 7 is the smallest divisor of 1001.
		

Crossrefs

Programs

  • Maple
    with(numtheory):for n from 1 to 100 do:x:=convert(n,base,10):n1:=nops(x): s:=sum('x[i]*10^(n1-i)', 'i'=1..n1):y:=n*10^n1+s:z:=factorset(y):n2:=nops(z):d:=z[1]:printf(`%d, `,d):od:
  • Mathematica
    d[n_]:=IntegerDigits[n];Table[FactorInteger[FromDigits[Join[x=d[n],Reverse[x]]]][[1,1]],{n,1,100}]
    Table[FactorInteger[#][[1,1]]&/@Select[Range[10^n,10^(n+1)-1],PalindromeQ],{n,1,3,2}]//Flatten (* Harvey P. Dale, Jul 19 2021 *)
  • Python
    from sympy import primefactors
    def a(n): s = str(n); return min(primefactors(int(s + s[::-1])))
    print([a(n) for n in range(1, 83)]) # Michael S. Branicky, Nov 02 2021

Formula

a(n) = A020639(A056524(n)).

A272232 Smallest k > 0 such that R_k//n//R_k is prime, where R_k is the repunit A002275(k) of length k and // denotes concatenation; or -1 if no such k exists.

Original entry on oeis.org

1, 9, -1, 1, 2, 1, 10, 3, 1, 1, 3, -1, 2, 3, 33, 1, 2, 1, 1, 21, 1, 2, -1, 1, 7, 48, 292, 4, 3, 1, 1, 2, 1, -1, 135, -1, 1, -1, 1, 34, 3, 3, 40, 2, -1, 1, 3, 1, 1, 32, 61, 1, 2, 1, 137, -1, 3, 1, 2, 42, 1, 14, 1, 262, 2, 22, -1, 3, 9, 2, 33, 73, 1, 3, 1, 2, 3, -1, 2, 2, 1
Offset: 0

Views

Author

Felix Fröhlich, Apr 23 2016

Keywords

Comments

a(2) = -1 (see second comment in A258372).
a(n) = -1 if n > 0 is in A099814 (see fourth comment in A004022).
a(n) = -1 if n is of the form A000042(i)*10^j+A000042(i) for some j > i > 0, since the resulting number is divisible by A002275(k)//A000042(i).
a(n) = -1 if n is a term of A010785 with an even number of digits, since any number of the form 1..1d..d1..1 with an even number of digits d is divisible by 11.
a(n) = 1 if there exists an integer x such that n = (A002275(A004023(x))-A011557(x)-1)/10.
From Chai Wah Wu, Nov 07 2019: (Start)
a(n) = -1 if n has an even number of digits and is a multiple of 11. In particular, a(n) = -1 if n is a term of A056524.
a(n) = -1 if n = (10^k+1)(10^m-1)/9 for some m > 0, k >= 0.
(End)
a(140) > 20000. - Hans Havermann, May 21 2022

Examples

			a(0) = 1 since 101 is prime; a(1) refers to the prime 1111111111111111111.
a(124) = -1 because R_k//124//R_k is divisible by 125*10^k-1.
		

Crossrefs

Programs

  • Mathematica
    Table[SelectFirst[Range[10^4], PrimeQ@ FromDigits@ Flatten@ {#, IntegerDigits@ n, #} &@ Table[1, {#}] &], {n, 0, 91}] /. k_ /; MissingQ@ k -> 0 (* Michael De Vlieger, Apr 25 2016, Version 10.2 *)
  • PARI
    a(n) = my(k=1); while(!ispseudoprime(eval(Str((10^k-1)/9, n, (10^k-1)/9))), k++); k

Extensions

a(35)-a(80) from Giovanni Resta, May 01 2016
Escape clausae value changed to -1 by N. J. A. Sloane, May 17 2022

A333440 Numbers where each digit can be paired with a digit of the same value at another position so that two pairs can be nested but cannot otherwise overlap.

Original entry on oeis.org

0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 1001, 1100, 1111, 1122, 1133, 1144, 1155, 1166, 1177, 1188, 1199, 1221, 1331, 1441, 1551, 1661, 1771, 1881, 1991, 2002, 2112, 2200, 2211, 2222, 2233, 2244, 2255, 2266, 2277, 2288, 2299, 2332, 2442, 2552, 2662, 2772, 2882
Offset: 1

Views

Author

Rémy Sigrist, Mar 21 2020

Keywords

Comments

The term 0 is included by convention (we consider here that it has no digit).
Each term has an even number of digits, and each digit has an even number of occurrences; hence each term belongs to A283871.
This sequence has connections with A014486; in both sequences digits are balanced in some way.
All palindromes with even number of digits belong to this sequence.
For any n > 0, the concatenation of the first n terms of A333399 or the concatenation of the first n+1 terms of A333399 belong to this sequence.

Examples

			The digits of 5586557768 can be paired as follows:
    (55)(8(6(55)(77)6)8)
so 5586557768 belongs to this sequence.
		

Crossrefs

Programs

  • PARI
    is(n, base=10) = { my (u=0, s=0); while (n, my (d=n%base); if (u && s%base==d, u--; s\=base, u++; s=s*base+d); n\=base); u==0 }

Formula

11 | a(n). - David A. Corneth, Mar 07 2021
Showing 1-10 of 15 results. Next