[go: up one dir, main page]

login
Revision History for A206916 (Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
Index of the least binary palindrome >=n; also the "upper inverse" of A006995.
(history; published version)
#28 by Michael De Vlieger at Wed Jul 24 17:22:32 EDT 2024
STATUS

reviewed

approved

#27 by Michel Marcus at Wed Jul 24 14:42:47 EDT 2024
STATUS

proposed

reviewed

#26 by Chai Wah Wu at Wed Jul 24 13:49:53 EDT 2024
STATUS

editing

proposed

#25 by Chai Wah Wu at Wed Jul 24 13:44:41 EDT 2024
PROG

s = bin(n)[2:]

return (n>>l-k)+(int(sbin(n)[k-+1:1:-1], or '0', 2)<(n&(1<<k)-1))+(1<<k-1+(l&1^1)) # Chai Wah Wu, Jul 24 2024

STATUS

proposed

editing

#24 by Chai Wah Wu at Wed Jul 24 12:33:59 EDT 2024
STATUS

editing

proposed

#23 by Chai Wah Wu at Wed Jul 24 12:33:53 EDT 2024
PROG

return (n>>l-k)+(int(s[k-1::-1], 2)<(n&(1<<k)-1))+(1<<k-1+(l&1^1)) # Chai Wah Wu, Jul 24 2024

#22 by Chai Wah Wu at Wed Jul 24 12:33:40 EDT 2024
PROG

(Python)

def A206916(n):

s = bin(n)[2:]

l = n.bit_length()

k = l+1>>1

return (n>>l-k)+(int(s[k-1::-1], 2)<(n&(1<<k)-1))+(1<<k-1+(l&1^1)) # Chai Wah Wu, Jul 24 2024

STATUS

approved

editing

#21 by Andrey Zabolotskiy at Sun Oct 15 12:01:27 EDT 2023
STATUS

editing

approved

#20 by Andrey Zabolotskiy at Sun Oct 15 12:01:25 EDT 2023
LINKS
CROSSREFS
STATUS

approved

editing

#19 by T. D. Noe at Thu Apr 12 12:13:19 EDT 2012
STATUS

editing

approved