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!)
A271497 If n is a multiple of 3 then a(n) = n/3, otherwise a(n) = n'+n'', where n' (resp. n'') is obtained by sorting the bits of the binary expansion of n into increasing (resp. decreasing) order. 4
0, 2, 3, 1, 5, 9, 2, 14, 9, 3, 15, 21, 4, 21, 21, 5, 17, 27, 6, 35, 27, 7, 35, 45, 8, 35, 35, 9, 35, 45, 10, 62, 33, 11, 51, 63, 12, 63, 63, 13, 51, 63, 14, 75, 63, 15, 75, 93, 16, 63, 63, 17, 63, 75, 18, 93, 63, 19, 75, 93, 20, 93, 93, 21, 65, 99, 22, 119, 99, 23, 119, 135, 24, 119, 119, 25, 119, 135 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
LINKS
EXAMPLE
11 = 1011_2, so n' = 0111_2 = 7, n'' = 1110_2 = 14, and therefore a(11) = 7+14 = 21.
MAPLE
A271497:=proc(n) local t1, t2, len; global b;
if n mod (b+1) = 0 then return(n/(b+1)); fi;
t1:=convert(n, base, b); len:=nops(t1);
t2:=sort(t1);
add(t2[i]*(b^(i-1)+b^(len-i)), i=1..len);
end;
b:=2; [seq(A271497(n), n=0..100)];
PROG
(Python)
from __future__ import division
def A271497(n):
return int(''.join(sorted(bin(n)[2:])), 2) + int(''.join(sorted(bin(n)[2:], reverse=True)), 2) if n % 3 else n//3 # Chai Wah Wu, Apr 16 2016
CROSSREFS
Sequence in context: A247582 A359795 A224652 * A293287 A236843 A055905
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Apr 16 2016
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 April 25 06:49 EDT 2024. Contains 371964 sequences. (Running on oeis4.)