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

A175298 Smallest number >=n whose binary representation is palindromic and has a 1 whenever the binary representation of n has a 1.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Mar 24 2010

Keywords

Comments

Old name: "Convert n to binary. OR each respective digit of binary n and binary A030101(n), where A030101(n) is the reversal of the order of the digits in the binary representation of n (given in decimal). a(n) is the decimal value of the result."
By "respective" digits of binary n and binary A030101(n), the rightmost digit of A030101(n) ( which is a 1) is OR'ed with the rightmost digit of n. A030101(n) is represented with the appropriate number of leading 0's.
This is the binary next-palindrome function, the base-2 analog of A262038. - N. J. A. Sloane, Dec 08 2015

Examples

			20 in binary is 10100. The reversal of the binary digits is 00101. So, from leftmost to rightmost respective digits, we OR 10100 and 00101: 1 OR 0 = 1. 0 OR 0 = 0. 1 OR 1 = 1. 0 OR 0 = 0. And 0 OR 1 = 1. So, 10100 OR 00101 is 10101, which is 21 in decimal. So a(20) = 21.
		

Crossrefs

Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.

Programs

  • Mathematica
    Table[f = IntegerDigits[x, 2]; f = f + Reverse[f]; FromDigits[ Table[If[Positive[f[[r]]], 1, 0], {r, 1, Length[f]}], 2], {x, STARTPOINT, ENDPOINT}] (* Dylan Hamilton, Oct 15 2010 *)
    f[n_] := Block[{id = IntegerDigits[n, 2]}, FromDigits[ BitOr[ id, Reverse@id], 2]]; Array[f, 72] (* Robert G. Wilson v, Nov 07 2010 *)

Extensions

Extended, with redundant initial entries included, by Dylan Hamilton, Oct 15 2010
Edited with new name and offset by N. J. A. Sloane, Dec 08 2015

A175919 Convert n to binary. XOR each respective digit of binary n and binary A030101(n), where A030101(n) is the reversal of the order of the digits in the binary representation of n (given in decimal). a(n) is the decimal value of the result.

Original entry on oeis.org

0, 0, 3, 0, 5, 0, 5, 0, 9, 0, 15, 6, 15, 6, 9, 0, 17, 0, 27, 10, 17, 0, 27, 10, 27, 10, 17, 0, 27, 10, 17, 0, 33, 0, 51, 18, 45, 12, 63, 30, 45, 12, 63, 30, 33, 0, 51, 18, 51, 18, 33, 0, 63, 30, 45, 12, 63, 30, 45, 12, 51, 18, 33, 0, 65, 0, 99, 34, 85, 20, 119, 54, 65, 0, 99, 34, 85, 20, 119
Offset: 0

Views

Author

Dylan Hamilton, Oct 15 2010

Keywords

Comments

Description format taken from Leroy Quet's OR and AND gate sequences for consistency.

Crossrefs

Or A175298 and And A175297 gate sequences. The rest of the equivalent sequences for other gates are adjacent.

Programs

  • Mathematica
    Table[f = IntegerDigits[x, 2]; f = f + Reverse[f]; FromDigits[ Table[If[OddQ[f[[r]]], 1, 0], {r, 1, Length[f]}], 2], {x, STARTPOINT,ENDPOINT}]

Formula

a(n) = A003987(n, A030101(n)).

A370427 a(n) is the least k >= 0 such that n OR k is a binary palindrome (where OR denotes the bitwise OR operator).

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 5, 4, 3, 2, 1, 0, 1, 0, 9, 8, 1, 0, 9, 8, 3, 2, 1, 0, 3, 2, 1, 0, 1, 0, 17, 16, 9, 8, 25, 24, 5, 4, 21, 20, 1, 0, 17, 16, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 0, 33, 32, 17, 16, 49, 48, 1, 0, 33, 32, 17, 16, 49, 48
Offset: 0

Views

Author

Rémy Sigrist, Feb 18 2024

Keywords

Comments

The binary expansions of n and a(n) have no common 1's.

Examples

			The first terms, alongside the corresponding binary expansions, are:
  n   a(n)  bin(n)  bin(a(n))  bin(n OR a(n))
  --  ----  ------  ---------  --------------
   0     0       0          0               0
   1     0       1          0               1
   2     1      10          1              11
   3     0      11          0              11
   4     1     100          1             101
   5     0     101          0             101
   6     1     110          1             111
   7     0     111          0             111
   8     1    1000          1            1001
   9     0    1001          0            1001
  10     5    1010        101            1111
  11     4    1011        100            1111
  12     3    1100         11            1111
  13     2    1101         10            1111
  14     1    1110          1            1111
  15     0    1111          0            1111
		

Crossrefs

Cf. A006995, A030101, A175297, A344220 (XOR variant).

Programs

  • Mathematica
    A370427[n_] := With[{r = IntegerReverse[n, 2]}, r - BitAnd[n, r]];
    Array[A370427, 2^7, 0] (* Paolo Xausa, Feb 20 2024 *)
  • PARI
    a(n) = my (r = fromdigits(Vecrev(binary(n)), 2)); r - bitand(n, r)

Formula

n AND a(n) = 0 (where AND denotes the bitwise AND operator).
a(n) = A030101(n) - (n AND A030101(n)).
a(n) = A030101(n) - A175297(n) (for any n > 0).
a(n) = 0 iff n belongs to A006995.

A175917 Convert n to binary. NOR each respective digit of binary n and binary A030101(n), where A030101(n) is the reversal of the order of the digits in the binary representation of n (given in decimal). a(n) is the decimal value of the result.

Original entry on oeis.org

0, 0, 0, 0, 2, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 14, 14, 4, 4, 10, 10, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 30, 30, 12, 12, 18, 18, 0, 0, 18, 18, 0, 0, 18, 18, 0, 0, 12, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 62, 28, 28, 42, 42, 8, 8, 54, 54, 20, 20, 34, 34, 0, 0, 42, 42, 8, 8, 42, 42, 8, 8, 34
Offset: 0

Views

Author

Dylan Hamilton, Oct 15 2010

Keywords

Comments

Description format taken from Leroy Quet's OR and AND gate sequences for consistency.

Crossrefs

Or A175298 and And A175297 gate sequences. The rest of the equivalent sequences for other gates are adjacent.

Programs

  • Mathematica
    Table[f = IntegerDigits[x, 2]; f = f + Reverse[f]; FromDigits[ Table[If[Positive[f[[r]]], 0, 1], {r, 1, Length[f]}], 2], {x, STARTPOINT,ENDPOINT}]

A175918 Convert n to binary. NAND each respective digit of binary n and binary A030101(n), where A030101(n) is the reversal of the order of the digits in the binary representation of n (given in decimal). a(n) is the decimal value of the result.

Original entry on oeis.org

0, 0, 3, 0, 7, 2, 5, 0, 15, 6, 15, 6, 15, 6, 9, 0, 31, 14, 31, 14, 27, 10, 27, 10, 31, 14, 21, 4, 27, 10, 17, 0, 63, 30, 63, 30, 63, 30, 63, 30, 63, 30, 63, 30, 51, 18, 51, 18, 63, 30, 45, 12, 63, 30, 45, 12, 63, 30, 45, 12, 51, 18, 33, 0, 127, 62, 127, 62, 127, 62, 127, 62, 119, 54, 119
Offset: 0

Views

Author

Dylan Hamilton, Oct 15 2010

Keywords

Comments

Description format taken from Leroy Quet's OR and AND gate sequences for consistency.

Crossrefs

Or A175298 and And A175297 gate sequences. The rest of the equivalent sequences for other gates are adjacent.

Programs

  • Mathematica
    Table[f = IntegerDigits[x, 2]; f = f + Reverse[f]; FromDigits[ Table[If[f[[r]] < 2, 1, 0], {r, 1, Length[f]}], 2], {x, STARTPOINT,ENDPOINT}]

A175920 Convert n to binary. XNOR each respective digit of binary n and binary A030101(n), where A030101(n) is the reversal of the order of the digits in the binary representation of n (given in decimal). a(n) is the decimal value of the result.

Original entry on oeis.org

0, 1, 0, 3, 2, 7, 2, 7, 6, 15, 0, 9, 0, 9, 6, 15, 14, 31, 4, 21, 14, 31, 4, 21, 4, 21, 14, 31, 4, 21, 14, 31, 30, 63, 12, 45, 18, 51, 0, 33, 18, 51, 0, 33, 30, 63, 12, 45, 12, 45, 30, 63, 0, 33, 18, 51, 0, 33, 18, 51, 12, 45, 30, 63, 62, 127, 28, 93, 42, 107, 8, 73, 62, 127, 28, 93, 42
Offset: 0

Views

Author

Dylan Hamilton, Oct 15 2010

Keywords

Comments

Description format taken from Leroy Quet's OR and AND gate sequences for consistency.

Crossrefs

Or A175298 and And A175297 gate sequences. The rest of the equivalent sequences for other gates are adjacent.

Programs

  • Mathematica
    Table[f = IntegerDigits[x, 2]; f = f + Reverse[f]; FromDigits[ Table[If[EvenQ[f[[r]]], 1, 0], {r, 1, Length[f]}], 2], {x, STARTPOINT,ENDPOINT}]
Showing 1-6 of 6 results.