login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Please make a donation to keep the OEIS running. We are now in our 56th year. In the past year we added 10000 new sequences and reached almost 9000 citations (which often say "discovered thanks to the OEIS").
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A330717 a(n) is the greatest binary palindrome of the form floor(n/2^k) with k >= 0. 1
0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 5, 3, 3, 7, 15, 1, 17, 9, 9, 5, 21, 5, 5, 3, 3, 3, 27, 7, 7, 15, 31, 1, 33, 17, 17, 9, 9, 9, 9, 5, 5, 21, 21, 5, 45, 5, 5, 3, 3, 3, 51, 3, 3, 27, 27, 7, 7, 7, 7, 15, 15, 31, 63, 1, 65, 33, 33, 17, 17, 17, 17, 9, 73, 9, 9, 9, 9 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,4

COMMENTS

In other words, a(n) is the greatest binary palindromic prefix of n.

LINKS

Rémy Sigrist, Table of n, a(n) for n = 0..8192

Index entries for sequences related to binary expansion of n

FORMULA

A070939(a(n)) = A215467(n).

a(n) = 1 iff n is a power of 2.

a(n) <= n with equality iff n is a binary palindrome (A006995).

a(a(n)) = a(n).

a(2*n) = a(n).

EXAMPLE

The first terms, alongside the binary representations of n and of a(n), are:

  n   a(n)  bin(n)  bin(a(n))

  --  ----  ------  ---------

   0     0       0          0

   1     1       1          1

   2     1      10          1

   3     3      11         11

   4     1     100          1

   5     5     101        101

   6     3     110         11

   7     7     111        111

   8     1    1000          1

   9     9    1001       1001

  10     5    1010        101

  11     5    1011        101

PROG

(PARI) a(n, b=2) = { my (d=digits(n, b)); forstep (w=#d, 1, -1, my (h=d[1..w]); if (h==Vecrev(h), return (fromdigits(h, b)))); return (0) }

CROSSREFS

Cf. A006995, A215467.

Sequence in context: A161825 A099551 A211206 * A036233 A145799 A331804

Adjacent sequences:  A330714 A330715 A330716 * A330718 A330719 A330720

KEYWORD

nonn,base,easy

AUTHOR

Rémy Sigrist, Dec 28 2019

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 25 20:20 EST 2020. Contains 338627 sequences. (Running on oeis4.)