login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A374348 a(n) = k where wt(k) = n and k + wt(k) = a power of two, where wt(n) = A000120(n) = binary weight of n. 0
1, 6, 13, 60, 59, 250, 505, 2040, 1015, 4086, 8181, 32756, 32755, 131058, 262129, 1048560, 262127, 1048558, 2097133, 8388588, 8388587, 33554410, 67108841, 268435432, 134217703, 536870886, 1073741797, 4294967268, 4294967267, 17179869154, 34359738337, 137438953440 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
k is uniquely determined by finding the power of two for which k = 2^x - n has wt(k) = n.
Terms are not always increasing, since the number of 0 bits in n-1 reduces k.
LINKS
FORMULA
a(n) = 2^A230300(n) - n.
a(n) = 2^(n + A000120(n-1)) - n.
a(n) = 2 * A129195(n-1) - n.
a(n) == n (mod 2).
EXAMPLE
For n = 4, 60 in binary is 111100, which has sum of digits of 4, and 60 + 4 = 64, a power of two.
For n = 5, 59 in binary is 111011, which has sum of digits of 5, and 59 + 5 = 64.
MAPLE
a:= n-> 2^(n+add(i, i=Bits[Split](n-1)))-n:
seq(a(n), n=1..32); # Alois P. Heinz, Jul 05 2024
PROG
(Python)
def a(n):
return (1 << (n + (n-1).bit_count())) - n
CROSSREFS
Sequence in context: A367663 A330283 A361244 * A262238 A111366 A177127
KEYWORD
nonn,base,easy,new
AUTHOR
Steven Reyes, Jul 05 2024
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 28 23:06 EDT 2024. Contains 374727 sequences. (Running on oeis4.)