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 21-30 of 31 results. Next

A154810 Nonpalindromic numbers with binary digits only.

Original entry on oeis.org

10, 100, 110, 1000, 1010, 1011, 1100, 1101, 1110, 10000, 10010, 10011, 10100, 10110, 10111, 11000, 11001, 11010, 11100, 11101, 11110, 100000, 100010, 100011, 100100, 100101, 100110, 100111, 101000, 101001, 101010, 101011, 101100, 101110, 101111
Offset: 1

Views

Author

Omar E. Pol, Jan 24 2009

Keywords

Comments

A154809 written in base 2.

Crossrefs

Programs

  • Mathematica
    Map[FromDigits, Select[IntegerDigits[Range[50], 2], !PalindromeQ[#] &]] (* Paolo Xausa, Jul 24 2024 *)
  • Python
    def A154810(n):
        def f(x): return n+(x>>(l:=x.bit_length())-(k:=l+1>>1))-(int(bin(x)[k+1:1:-1],2)>(x&(1<Chai Wah Wu, Jul 24 2024

Formula

a(n) = A007088(A154809(n)). - Michel Marcus, Jul 24 2024

Extensions

Extended by Ray Chandler, Mar 14 2010

A192776 Squares of binary palindromes.

Original entry on oeis.org

0, 1, 1001, 11001, 110001, 1010001, 11100001, 100100001, 110111001, 1011011001, 1111000001, 10001000001, 11111101001, 101000101001, 111110000001, 1000010000001, 1010011010001, 1110000111001, 10000111001001, 10011001001001, 10110010111001, 11011101010001, 11111100000001, 100000100000001, 101101101110001, 110101001011001, 1000101110001001, 1001010010001001, 1011101101011001, 1101000001110001, 1111111000000001, 10000001000000001, 10010001100100001
Offset: 1

Views

Author

N. J. A. Sloane, Jul 09 2011

Keywords

Crossrefs

This is A192775 written in base 2, also A006995 (or A057148) squared. Cf. A006995, A057148.

Programs

  • Python
    def A192776(n):
        if n == 1: return 0
        a = 1<<(l:=n.bit_length()-2)
        m = a|(n&a-1)
        return int(bin(((m<Chai Wah Wu, Jul 23 2024

A262556 Even numbers that are not the sum of two binary palindromes (written in base 2).

Original entry on oeis.org

10110000, 10111100, 11010000, 11110010, 11110100, 100110110, 1000001100, 1001110100, 1010010000, 1011100000, 1011110010, 1100011010, 1101000000, 1101011110, 1101100010, 1101100100, 1101110000, 1110100100, 1110110000, 1111100010, 1111101000, 10010011100, 10011011000, 10100011100, 10100011110
Offset: 1

Views

Author

N. J. A. Sloane, Oct 12 2015

Keywords

Comments

This is A261678 written in base 2.
It would be nice to have an independent characterization of these binary strings.
Binary palindromes are odd, so no odd number is the sum of two of them.

Crossrefs

See also A006995 and A057148 (binary palindromes).

A342036 Palindromes of even length only using 0 or 1.

Original entry on oeis.org

0, 11, 1001, 1111, 100001, 101101, 110011, 111111, 10000001, 10011001, 10100101, 10111101, 11000011, 11011011, 11100111, 11111111, 1000000001, 1000110001, 1001001001, 1001111001, 1010000101, 1010110101, 1011001101, 1011111101, 1100000011, 1100110011
Offset: 0

Views

Author

Seiichi Manyama, Feb 26 2021

Keywords

Comments

Subsequence of A057148.
a(n) is a multiple of 11.

Examples

			A006995|A057148|A048701|A342036|A048700|A342040
-------+-------+-------+-------+-------+-------
     0 |     0 |     0 |     0 |       |
     1 |     1 |       |       |     1 |     1
     3 |    11 |     3 |    11 |       |
     5 |   101 |       |       |     5 |   101
     7 |   111 |       |       |     7 |   111
     9 |  1001 |     9 |  1001 |       |
    15 |  1111 |    15 |  1111 |       |
    17 | 10001 |       |       |    17 | 10001
		

Crossrefs

Programs

  • Mathematica
    Array[FromDigits@ Join[#, Reverse[#]] &@ IntegerDigits[#, 2] &, 26, 0] (* Michael De Vlieger, Feb 26 2021 *)
  • Python
    def a(n): b = bin(n)[2:]; return int(b+b[::-1])
    print([a(n) for n in range(27)]) # Michael S. Branicky, Feb 26 2021
  • Ruby
    def A(n)
      str = n.to_s(2)
      (str + str.reverse).to_i
    end
    def A342036(n)
      (0..n).map{|i| A(i)}
    end
    p A342036(30)
    

Formula

a(n) = A007088(n) * 10^A070939(n) + A305989(n).
a(n) = A007088(A048701(n)). - Michel Marcus, Feb 26 2021

Extensions

Offset changed to 0 by Andrey Zabolotskiy, Dec 26 2022

A342040 Binary palindromes of odd length.

Original entry on oeis.org

1, 101, 111, 10001, 10101, 11011, 11111, 1000001, 1001001, 1010101, 1011101, 1100011, 1101011, 1110111, 1111111, 100000001, 100010001, 100101001, 100111001, 101000101, 101010101, 101101101, 101111101, 110000011, 110010011, 110101011
Offset: 1

Views

Author

Seiichi Manyama, Feb 26 2021

Keywords

Comments

Subsequence of A057148.

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := FromDigits[Join[#, {Mod[n, 2]}, Reverse[#]] &@ IntegerDigits[Floor[n/2], 2]]; Array[a, 26] (* Amiram Eldar, Apr 28 2021 *)
  • Python
    def A342040(n):
        s = bin(n)[2:]
        return int(s+s[-2::-1]) # Chai Wah Wu, Feb 26 2021

Formula

a(n) = A007088(A048700(n)).

A043261 Sum of the binary digits of the n-th base-2 palindrome.

Original entry on oeis.org

0, 1, 2, 2, 3, 2, 4, 2, 3, 4, 5, 2, 4, 4, 6, 2, 3, 4, 5, 4, 5, 6, 7, 2, 4, 4, 6, 4, 6, 6, 8, 2, 3, 4, 5, 4, 5, 6, 7, 4, 5, 6, 7, 6, 7, 8, 9, 2, 4, 4, 6, 4, 6, 6, 8, 4, 6, 6, 8, 6, 8, 8, 10, 2, 3, 4, 5, 4, 5, 6, 7, 4, 5, 6, 7, 6, 7, 8, 9, 4, 5, 6, 7, 6, 7, 8, 9, 6, 7, 8
Offset: 1

Views

Author

Keywords

Examples

			The fourth base-2 palindrome is 5 = 101_2, so a(4) = 1+0+1 = 2.
		

Crossrefs

Cf. A006995 (base-2 palindromes), A057148.

Programs

  • Maple
    b:= proc(n) option remember;
      procname(floor(n/2)) end proc;
    b(1):= 0; b(2):= 1;
    c:= proc(n) option remember;
      procname(floor(n/2)) + (n mod 2) end proc;
    c(1):= 0; c(2):= 1;
    A043261:= n -> 2*c(n) - (n mod 2)*b(n);
    A043261(2):= 1;# Robert Israel, Apr 06 2014
  • Python
    def A043261(n):
        if n == 1: return 0
        a = 1<<(l:=n.bit_length()-2)
        m = a|(n&a-1)
        return (m.bit_count()<<1) - (0 if a&n else m&1) # Chai Wah Wu, Jun 13 2024

Formula

Let b(1) = 0, b(2) = 1, otherwise b(2*n-1) = b(n-1) and b(2*n) = b(n).
Let c(1) = 0, c(2) = 1, otherwise c(2*n-1) = c(n-1)+1 and c(2*n) = c(n).
Then for n >= 2, a(2*n-1) = 2*c(2*n-1) - b(2*n-1) and a(2*n) = 2*c(2*n).

Extensions

edited by Robert Israel, Apr 06 2014

A143906 a(n) is A143905(n) written in binary.

Original entry on oeis.org

1001, 10011001, 10100101, 11000011, 100011110001, 100101101001, 100110011001, 101001100101, 101010010101, 101100001101, 110001100011, 110010010011, 110100001011, 111000000111, 1000011111100001, 1000101111010001
Offset: 1

Views

Author

Leroy Quet, Sep 04 2008

Keywords

Comments

This sequence lists all finite binary strings that are palindromes with an equal number of 0's and 1's and that each start and end with 1, listed in order of the strings' numerical values if the strings are considered to be base 2 numbers.

Crossrefs

Formula

Intersection of A057148 and A071925. - R. J. Mathar, Sep 05 2008

Extensions

Extended by R. J. Mathar, Sep 05 2008
Corrected comment. - Leroy Quet, Oct 13 2008

A307319 Minimum number of concatenated palindromes needed to express first n terms of the Thue-Morse sequence (A010060).

Original entry on oeis.org

0, 1, 2, 2, 1, 2, 3, 3, 2, 3, 4, 3, 2, 3, 3, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5, 4, 3, 4, 4, 3, 2, 3, 4, 4, 3, 4, 5, 5, 4, 5, 5, 4, 3, 4, 4, 3, 2, 3, 4, 4, 3, 4, 5, 4, 3, 4, 4, 3, 2, 3, 3, 2, 1, 2, 3, 3, 2, 3, 4, 4, 3, 4, 5, 4, 3, 4, 4, 3, 2, 3, 4, 4, 3, 4, 5
Offset: 0

Views

Author

Jeffrey Shallit, Apr 02 2019

Keywords

Examples

			The first 6 terms of the Thue-Morse sequence are 011010, and this can be written as the concatenation of three palindromes: (0110)(1)(0), and no fewer.
		

Crossrefs

A327296 a(n) is the decimal value of the largest binary palindrome that can be obtained from the digits of the binary representation of n.

Original entry on oeis.org

0, 1, 1, 3, 1, 5, 5, 7, 1, 9, 9, 7, 9, 7, 7, 15, 1, 17, 17, 21, 17, 21, 21, 27, 17, 21, 21, 27, 21, 27, 27, 31, 1, 33, 33, 21, 33, 21, 21, 51, 33, 21, 21, 51, 21, 51, 51, 31, 33, 21, 21, 51, 21, 51, 51, 31, 21, 51, 51, 31, 51, 31, 31, 63, 1, 65, 65, 73, 65, 73
Offset: 0

Views

Author

Ian Band, Sep 16 2019

Keywords

Comments

a(n) is the largest-valued binary palindrome that can be constructed from the binary representation of n. The palindrome may not have a leading 0.
When constructing a palindrome from a binary string, digits may only be permuted and deleted. I.e., the constructed palindrome will contain the same number or fewer 1's and 0's as the original binary string.
The algorithm is as follows:
If there is an odd number of 1's in the original binary string, start by placing a 1 in the middle of the output palindrome. Note that the remaining number of 1's is now even. If the remaining number of 1's is zero, then the constructed palindrome is simply "1" because the constructed palindrome cannot have leading zeros. If the remaining number of 1's is greater than zero, then place the remaining 0's evenly on either side of the previously placed "1". Because the output must be a palindrome, if the original string contains an odd number of 0's, then one of the 0's will be discarded. Lastly, place the remaining 1's on either end of the constructed palindrome.
If there is an even number of 1's in the original binary string, start by placing all of the 0's from the original string in the center of the palindrome, then place the 1's evenly on either side of the 0's.

Examples

			The largest palindrome that can be constructed:
For 101  it is  101, thus a(5)  = 5.
For 1000 it is    1, thus a(8)  = 1.
For 1010 it is 1001, thus a(10) = 9.
For 1011 it is  111, thus a(11) = 7.
		

Crossrefs

Cf. A006995 (binary palindromes), A057148.

Programs

  • Mathematica
    a[n_] := Block[{o,z}, {o,z} = DigitCount[n, 2]; If[o==1, 1, If[OddQ@ o, {o,z} = Floor[{o,z} /2]; 2^(z + o) + (2^o - 1) (1 + 2^(o + 1 + 2 z)), o = o/2; (2^o - 1) (1 + 2^(o + z))]]]; a /@ Range[0, 70] (* Giovanni Resta, Sep 16 2019 *)
  • Python
    def a(n):
        #convert n to binary string
        bin_str = str(bin(n))[2:]
        #count 1's and 0's in the string
        zeros = bin_str.count('0')
        ones  = len(bin_str) - zeros
        if(ones == 1 or ones == 0):
            return ones
        pal = ""
        if(ones % 2 == 1):
            #start by placing a '1' in the middle of the string
            pal = '1'
            #place as many 0's around the central '1' as possible
            for i in range(0, zeros >> 1):
                    pal = '0' + pal + '0'
        else:
            #place all 0's in the center
            for i in range(0, zeros):
                pal += '0'
        #place the remaining 1's (guaranteed to be an even number, because one '1' was placed in the middle) on either side of the palindrome
        for i in range(0, ones >> 1):
            pal = '1' + pal + '1'
        #return integer value of the constructed palindrome
        return int(pal, 2)

Extensions

More terms from Giovanni Resta, Sep 16 2019

A330022 Length of shortest binary string containing, as contiguous blocks, all palindromes of length n.

Original entry on oeis.org

0, 2, 4, 8, 12, 22, 32
Offset: 0

Views

Author

Jeffrey Shallit, Nov 27 2019

Keywords

Comments

Greedy supersequence algorithms give the upper bounds a(7) <= 60, a(8) <= 74, a(9) <= 142, a(10) <= 180, a(11) <= 344, a(12) <= 410, a(13) <= 798. Probably some of these are tight. The value for a(6) was computed by checking all 8! arrangements of the 8 palindromes of length 3, optimizing overlaps. Probably someone with more computing power could compute a(7) (resp., a(8)) by checking all 16! = 20922789888000 arrangements of the palindromes of length 7 (resp., 8).

Examples

			The corresponding strings for 1 <= n <= 6 are:
1: 01
2: 0011
3: 00010111
4: 000011001111
5: 0000010001010111011111
6: 00000011001111000010010110111111
		

Crossrefs

Cf. A057148.
Previous Showing 21-30 of 31 results. Next