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 11 results. Next

A228407 The digits of a(n) and a(n+1) together can be reordered to form a palindromic integer; the lexicographically earliest injective sequence of nonnegative integers with this property.

Original entry on oeis.org

0, 11, 1, 10, 100, 12, 2, 20, 101, 22, 3, 13, 31, 103, 30, 110, 33, 4, 14, 41, 104, 40, 114, 24, 42, 112, 21, 102, 120, 201, 210, 1000, 105, 15, 5, 25, 52, 115, 35, 53, 113, 23, 32, 121, 26, 6, 16, 61, 106, 60, 116, 36, 63, 131, 34, 43, 134, 143, 314
Offset: 0

Views

Author

Eric Angelini and M. F. Hasler, Nov 09 2013

Keywords

Comments

For each n=0,1,2,3..., choose the smallest nonnegative integer a(n) not occurring earlier such that the digits of a(n) and a(n-1) (none for n=0) taken together can form a palindrome when suitably reordered.
It is conjectured that the sequence is a permutation of the nonnegative integers (motivating the choice of offset 0), i.e., that all numbers will eventually occur. (The conjecture is true - see below. - N. J. A. Sloane, Nov 12 2013)
To test this conjecture, consider the indices n where the smallest integers not yet used occur. If the conjecture is true, this is equivalent to a(m)>a(n) for all m>n; if not, then this list ends at the first missing number. These [n,a(n)] are: [0, 0], [2, 1], [6, 2], [10, 3], [17, 4], [34, 5], [45, 6], [65, 7], [81, 8], [118, 9], [119, 29], [122, 39], [145, 44], [152, 45], [197, 46], [230, 47], [271, 48], [362, 49], [533, 57], [740, 58], [754, 68], [816, 69], [855, 89], [856, 98], [857, 198], [1011, 211], [1012, 222], [1110, 224], [1232, 225], [1385, 234], [1406, 236], [1413, 237], [1767, 238], [1921, 239], [2555, 257], [2590, 259], [2597, 269], [4354, 279], [4355, 297], [4361, 379], [4362, 397], [4368, 479], [4369, 497],...
See A228410 for the variant considering only positive integers, and comments about the differences.
Sequence A228412 is an "arithmetic" variant, where instead of the union of the digits, the sum of terms is considered. Sequence A062932 is a further variant where injectivity is replaced by monotonicity.
From N. J. A. Sloane, Nov 13 2013: (Start)
Theorem. In any base b >= 2, Eric Angelini's "palindrome" sequence (A228407 in base 10, A230891 and A230892 in base 2) contains every number n >= 0 and is therefore a permutation of the numbers n >= 0.
Proof. Fix the base b >= 2. Classify numbers n into 2^b classes according to the parity of the numbers of 0's, 1's, ..., b-1's they contain.
Construct a graph G with these 2^b classes as nodes, with two nodes joined by an edge iff they are at Hamming distance 0 or 1 apart. This is the b-dimensional cube graph with a loop at each node.
Let S = a(0), a(1), ... denote Angelini's palindromic sequence in base b. A set of digits can be arranged to form a palindrome iff there is an even number of copies of every digit or exactly one of the digits occurs an odd number of times.
At step n, write a(n) on the node of G corresponding to its parity class. The previous remark implies that the successive a(i) will trace out an infinite path in the graph.
At least one node must be visited infinitely often.
The rule for constructing the sequence implies that each node adjacent to a node that is visited infinitely often must also be visited infinitely often. Since G is connected, every node is visited infinitely often. Therefore every number must appear in the sequence, for if a number never appeared, the node corresponding to its parity class would only be visited finitely many times. QED.
Thanks to Rob Arthan for comments on the original version of this proof. (End)
From Robert G. Wilson v, Dec 31 2013: (Start)
Records: 0, 11, 100, 101, 103, 110, 114, 120, 201, 210, 1000, 1003, 1007, 1008, 1020, 1029, 1030, 1040, 1047, 1048, 1082, 1208, 1280, 1802, 1820, 2018, 2081, 2108, 2180, 2801, 2810, 8012, 8021, 8102, 8120, 8201, 8210, 10002, 10004, 10007, 10020, 10060, 10080, 10081, 10100, 10105, 10113, 10304, ... [See A377925, A377926. - N. J. A. Sloane, Dec 14 2024]
Last occurrence: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 29, 39, 44, 45, 46, 47, 48, 49, 57, 58, 68, 69, 89, 98, 198, 211, 222, 224, 225, 234, 236, 237, 238, 239, 257, 259, 269, 279, 297, 379, 397, 479, 497, 589, ... ;
Index of last occurrence: 0, 2, 6, 10, 17, 34, 45, 65, 81, 118, 119, 122, 145, 152, 197, 230, 271, 362, 533, 740, 754, 816, 855, 856, 857, 1011, 1012, 1110, 1232, 1385, 1406, 1413, 1767, 1921, 2555, 2590, 2597, 4354, 4355, 4361, 4362, 4368, 4369, ... . (End)

Examples

			The second term cannot be "1", because a palindrome cannot be formed from the digits in "01". The second term cannot be "10" because "010", though a palindrome, is not a palindromic integer. However "11" is permissible because "101" is a palindrome. Thus the second term is 11.
The third term can be 1 because 111 is a palindrome.
		

Crossrefs

A228730, A231880, A231881 are similar sequences.
Records: A377925, A377926.

Programs

  • Mathematica
    a[0] = 0; a[n_] := a[n] = Block[{k = 1, idm = IntegerDigits@ a[n - 1]}, Label[ start]; While[ MemberQ[ a@# & /@ Range[n - 1], k], k++]; While[ idk = IntegerDigits @k; Select[ Permutations[ Join[idm, idk]], #[[1]] != 0 && # == Reverse@# &] == {}, k++; Goto[start]]; k]; Array[ a, 60, 0] (* Robert G. Wilson v, Nov 10 2013 *)
  • PARI
    {u=0; a=0; for(n=1,99, u+=1<
    				
  • Python
    from collections import Counter
    A228407_list, l, s, b = [0, 11], Counter('11'), 1, set([11])
    for _ in range(10**2):
        i = s
        while True:
            if i not in b:
                li, o = Counter(str(i)), 0
                for d in (l+li).values():
                    if d % 2:
                        if o > 0:
                            break
                        o += 1
                else:
                    A228407_list.append(i)
                    l = li
                    b.add(i)
                    while s in b:
                        b.remove(s)
                        s += 1
                    break
            i += 1 # Chai Wah Wu, Dec 14 2014

Extensions

Terms independently calculated by Rob Arthan, Nov 09 2013
Comments edited by N. J. A. Sloane, Dec 14 2024

A062932 a(0) = 0; a(n) = smallest number > a(n-1) such that a(n-1)+a(n) is a palindrome.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 16, 17, 27, 28, 38, 39, 49, 50, 51, 60, 61, 70, 71, 80, 81, 90, 91, 100, 102, 110, 112, 120, 122, 130, 132, 140, 142, 150, 153, 160, 163, 170, 173, 180, 183, 190, 193, 200, 204, 210, 214, 220, 224, 230, 234, 240, 244, 250, 255, 260, 265, 270
Offset: 0

Views

Author

Amarnath Murthy, Jul 05 2001

Keywords

Examples

			17 is a term hence the next term is 27, as 17 + 27 = 44 is a palindrome, but 17 + 18 = 35 through 17 + 26 = 43 are not palindromes.
		

Crossrefs

Cf. A228730 (non-monotonic variant).

Programs

  • Mathematica
    palQ[n_] := Block[{d = IntegerDigits@ n}, Reverse@ d == d]; a = {1}; Do[k = a[[n - 1]] + 1; While[! palQ[a[[n - 1]] + k], k++]; AppendTo[a, k], {n, 2, 58}]; {0}~Join~a (* Michael De Vlieger, Oct 05 2015 *)
  • PARI
    digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) }
    Palin(x)= { local(y,d,e,f); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) }
    { for (n=1, 1000, if (n>1, while (!Palin(a1 + a++),); a1=a, a=a1=1); write("b062932.txt", n, " ", a) ) } \\ Harry J. Smith, Aug 13 2009

Extensions

Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jul 02 2001
Initial a(0)=0 prefixed by M. F. Hasler, Nov 09 2013

A347335 Lexicographically earliest sequence of distinct nonnegative integers such that the sum of three consecutive terms is a palindrome in base 10.

Original entry on oeis.org

0, 1, 2, 3, 4, 15, 14, 26, 37, 25, 39, 13, 36, 6, 24, 47, 17, 35, 49, 27, 12, 5, 16, 23, 38, 40, 10, 51, 50, 20, 7, 28, 9, 18, 61, 22, 48, 29, 11, 59, 31, 21, 69, 41, 71, 19, 81, 91, 30, 60, 101, 111, 70, 122, 80, 90, 32, 100, 110, 42, 120, 130, 53, 8, 141, 63, 58, 121, 33, 68, 131, 43
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Aug 28 2021

Keywords

Examples

			a(1) + a(2) + a(3) = 0 + 1 + 2 = 3 (palindrome);
a(2) + a(3) + a(4) = 1 + 2 + 3 = 6 (palindrome);
a(3) + a(4) + a(5) = 2 + 3 + 4 = 9 (palindrome);
a(4) + a(5) + a(6) = 3 + 4 + 15 = 22 (palindrome); etc.
		

Crossrefs

Cf. A228730.

Programs

  • Python
    def ispal(n): s = str(n); return s == s[::-1]
    def aupton(terms):
        alst, seen = [0, 1], {0, 1}
        for n in range(2, terms):
            an, partial_sum = 1, sum(alst[-2:])
            while an in seen or not ispal(partial_sum + an): an += 1
            alst.append(an); seen.add(an)
        return alst
    print(aupton(201)) # Michael S. Branicky, Aug 28 2021

A284049 a(n) is the smallest positive integer not already in the sequence such that a(n) + a(n-1) is a prime power, with a(1) = 1.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 9, 8, 11, 12, 13, 10, 15, 14, 17, 20, 21, 16, 25, 18, 19, 22, 27, 26, 23, 24, 29, 30, 31, 28, 33, 34, 37, 36, 35, 32, 39, 40, 41, 38, 43, 46, 51, 50, 47, 42, 55, 48, 49, 52, 45, 44, 53, 54, 59, 62, 63, 58, 67, 60, 61, 64, 57, 56, 65, 66, 71, 68, 69, 70, 79, 72, 77, 74, 75, 76, 73, 78, 85, 82
Offset: 1

Views

Author

Ilya Gutkovskiy, Mar 19 2017

Keywords

Comments

Conjectured to be a permutation of the natural numbers.

Examples

			a(8) = 9 because 1, 2, 3, 4, 5, 6 and 7 have already been used in the sequence, 7 + 8 = 15 is not prime power while 7 + 9 = 16 is a prime power.
		

Crossrefs

Programs

  • Maple
    N:= 100: # to get all terms before the first term > N
    S:= [$2..N]:
    a[1]:= 1: found:= true:
    for n from 2 while found do
      found:= false;
      for j from 1 to nops(S) do
        if ispp(a[n-1]+S[j]) then
          found:= true;
          a[n]:= S[j];
          S:= subsop(j=NULL,S);
          break
        fi
      od;
    od:
    seq(a[i],i=1..n-2); # Robert Israel, Apr 16 2017
  • Mathematica
    f[s_List] := Block[{k = 1, a = s[[-1]]}, While[MemberQ[s, k] || ! PrimePowerQ[a + k], k++]; Append[s, k]]; Nest[f, {1}, 80]

A322845 Lexicographically earliest sequence of distinct positive terms such that the sum of two consecutive terms has distinct digits in factorial base.

Original entry on oeis.org

1, 3, 2, 8, 5, 9, 4, 6, 7, 12, 10, 13, 33, 34, 43, 24, 22, 45, 23, 44, 38, 29, 17, 50, 18, 28, 39, 46, 21, 25, 42, 26, 20, 47, 30, 16, 51, 31, 15, 52, 49, 19, 27, 40, 37, 48, 53, 14, 32, 35, 11, 56, 54, 55, 60, 41, 36, 65, 173, 182, 174, 64, 291, 170, 68, 287
Offset: 1

Views

Author

Rémy Sigrist, Dec 29 2018

Keywords

Comments

In other words, for any n > 0, a(n) + a(n+1) belongs to A321682.
Apparently, all the positive integers appear in the sequence.
This sequence has interesting graphical features (see scatterplots in Links section).
This sequence is to A321682 what A228730 is to A002113.

Examples

			The first terms, alongside the factorial representation of a(n)+a(n+1), are:
  n   a(n)  fact(a(n)+a(n+1))
  --  ----  -----------------
   1     1              (2,0)
   2     3              (2,1)
   3     2            (1,2,0)
   4     8            (2,0,1)
   5     5            (2,1,0)
   6     9            (2,0,1)
   7     4            (1,2,0)
   8     6            (2,0,1)
   9     7            (3,0,1)
  10    12            (3,2,0)
  11    10            (3,2,1)
  12    13          (1,3,2,0)
		

Crossrefs

Programs

  • C
    // See Links section.

A284048 a(n) is the smallest positive integer not already in the sequence such that a(n) + a(n-1) is a proper prime power (A246547), with a(1) = 1.

Original entry on oeis.org

1, 3, 5, 4, 12, 13, 14, 2, 6, 10, 15, 17, 8, 19, 30, 34, 47, 74, 7, 9, 16, 11, 21, 28, 36, 45, 76, 49, 32, 89, 39, 25, 24, 40, 41, 23, 26, 38, 43, 78, 50, 31, 18, 46, 35, 29, 20, 44, 37, 27, 22, 42, 79, 90, 153, 103, 66, 55, 70, 51, 77, 48, 33, 88, 81, 162, 94, 75, 53, 68, 57, 64, 61, 60, 65, 56, 69, 52, 73, 96, 147
Offset: 1

Views

Author

Ilya Gutkovskiy, Mar 19 2017

Keywords

Examples

			a(5) = 12 because 1, 3, 4 and 5 have already been used in the sequence, 4 + 2 = 6, 4 + 6 = 10, 4 + 7 = 11, 4 + 8 = 12, 4 + 9 = 13, 4 + 10 = 14 and 4 + 11 = 15 are not proper prime powers while 4 + 12 = 16 is a proper prime power.
		

Crossrefs

Programs

  • Maple
    N:= 2000: # to get all terms before the first where a(n)+a(n-1)>N
    PP:= {seq(seq(p^j, j =2..floor(log[p](N))),p = select(isprime,[2,seq(i,i=3..floor(sqrt(N)),2)]))}:
    PP:= sort(convert(PP,list)):
    V:= Vector(N,datatype=integer[1],1):
    A[1]:= 1; V[1]:= 0;
    for n from 2 do
      for pp in PP do
        t:= pp - A[n-1];
        if t > 0 and V[t] = 1 then
          A[n]:= t; V[t]:= 0; break
        fi;
      od;
      if not assigned(A[n]) then break fi
    od:
    seq(A[i],i=1..n-1); # Robert Israel, Apr 24 2017
  • Mathematica
    f[s_List] := Block[{k = 1, a = s[[-1]]}, While[MemberQ[s, k] || ! (PrimePowerQ[a + k] && PrimeOmega[a + k] > 1), k++];Append[s, k]]; Nest[f, {1}, 80]

A337865 Lexicographically earliest sequence of distinct positive integers such that the sum of a(n) and [a(n+1) reversed] is a palindrome in base 10.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 17, 28, 37, 7, 18, 38, 16, 27, 47, 8, 19, 29, 51, 62, 73, 82, 71, 102, 9, 31, 42, 53, 64, 74, 41, 52, 63, 83, 61, 72, 92, 91, 111, 101, 121, 131, 141, 151, 15, 26, 57, 13, 24, 35, 46, 55, 11, 22, 33, 44, 75, 65, 21, 32, 43, 54, 76, 56, 12, 23, 34, 45, 66
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Sep 27 2020

Keywords

Comments

Terms ending in zero are not in the sequence; when reversed they produce a term with a leading zero.

Examples

			a(7) = 17 and a(8) = 28; the addition 17 + 82 is a palindrome (99).
a(8) = 28 and a(9) = 37; the addition 28 + 73 is a palindrome (101). Etc.
		

Crossrefs

Cf. A228730 (the sum of two consecutive terms is a palindrome in base 10).

A236689 The sum of two neighboring digits is a palindrome; a(n) is the smallest possible nonnegative integer not occurring earlier.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 10, 7, 11, 8, 12, 9, 20, 13, 14, 15, 16, 17, 18, 30, 21, 22, 23, 24, 25, 26, 27, 29, 200, 31, 32, 33, 34, 35, 36, 38, 100, 40, 41, 42, 43, 44, 45, 47, 101, 50, 51, 52, 53, 54, 56, 102, 60, 61, 62, 63, 65, 103, 80, 70, 71, 72, 74, 104
Offset: 0

Views

Author

Eric Angelini and M. F. Hasler, Jan 29 2014

Keywords

Comments

The sum of two digits is a palindrome iff it is less than 10 or equal to 11. Therefore, numbers with substrings 19, 28, 37, 39, 46, ... (this is not A065207) can never occur, and this is not a permutation of the nonnegative integers.

Crossrefs

Cf. A228730.

Programs

  • PARI
    a=u=0;(isp(s)=s<10||s==11);for(n=1,100,print1(a",");u+=1<1,d[j-1],a%10)+d[j])&&next;k=(k\10^(#d-j)+1)*10^(#d-j)-1;next(2));a=k;break))

A284047 a(n) is the smallest positive integer not already in the sequence such that a(n) + a(n-1) and a(n)^2 + a(n-1)^2 are primes, with a(1) = 1.

Original entry on oeis.org

1, 2, 3, 8, 5, 6, 11, 20, 23, 18, 35, 24, 19, 10, 7, 12, 17, 42, 25, 4, 9, 14, 15, 22, 57, 32, 27, 52, 37, 30, 13, 28, 33, 40, 39, 34, 45, 16, 31, 70, 69, 80, 21, 26, 41, 56, 51, 50, 53, 48, 65, 36, 71, 60, 29, 44, 59, 54, 85, 46, 81, 100, 49, 90, 61, 76, 91, 66, 101, 96, 55, 58, 73, 108, 43, 120, 79, 84, 145, 78, 103
Offset: 1

Views

Author

Ilya Gutkovskiy, Mar 19 2017

Keywords

Comments

Conjectured to be a permutation of the natural numbers.

Examples

			a(4) = 8 because 1, 2 and 3 have already been used in the sequence, 3 + 4 = 7 is a prime but 3^2 + 4^2 = 25 is not prime, 3 + 5 = 8, 3 + 6 = 9, 3 + 7 = 10 are not primes while 3 + 8 = 11 is a prime and 3^2 + 8^2 = 73 is a prime also.
		

Crossrefs

Programs

  • Mathematica
    f[s_List] := Block[{k = 1, a = s[[-1]]}, While[MemberQ[s, k] || ! (PrimeQ[a + k] && PrimeQ[a^2 + k^2]), k++]; Append[s, k]]; Nest[f, {1}, 80]

A318534 Lexicographically first sequence of distinct positive integers such that [a(n) + a(n+1)] or [a(n) - a(n+1)] is a palindrome in base 10.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 16, 7, 15, 18, 9, 13, 20, 12, 10, 23, 21, 34, 26, 29, 37, 40, 32, 24, 31, 35, 27, 17, 38, 28, 49, 39, 60, 41, 8, 14, 19, 25, 30, 36, 52, 47, 54, 43, 45, 56, 55, 11, 22, 44, 33, 66, 65, 46, 42, 57, 64, 67, 74, 77, 84, 87, 94, 97, 105, 76, 75, 86, 85, 96, 95, 107, 115, 117, 125, 127, 135, 137, 145, 147, 48
Offset: 1

Views

Author

Jean-Marc Falcoz and Eric Angelini, Aug 28 2018

Keywords

Comments

Is this sequence a permutation of the positive integers?

Examples

			The sequence starts with 1,2,3,4,5,6,16,7,15,18,9,... and we see that [1 + 2] is a palindrome (3); [2 + 3] is a palindrome (5); [3 + 4] is a palindrome (7); [4 + 5] is a palindrome (9); [5 + 6] is a palindrome (11); [6 + 16] is a palindrome (22); [16 - 7] is a palindrome (9); [7 + 15] is a palindrome (22); etc.
		

Crossrefs

Cf A228730 (Lexicographically earliest sequence of distinct nonnegative integers such that the sum of two consecutive terms is a palindrome in base 10).
Showing 1-10 of 11 results. Next