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.

Previous Showing 11-12 of 12 results.

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.

Original entry on oeis.org

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
Offset: 0

Views

Author

N. J. A. Sloane, Apr 16 2016

Keywords

Examples

			11 = 1011_2, so n' = 0111_2 = 7, n'' = 1110_2 = 14, and therefore a(11) = 7+14 = 21.
		

Crossrefs

Programs

  • 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)];
  • 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

A052009 Sum of 'n with digits sorted ascending' and 'n with digits sorted descending' is prime.

Original entry on oeis.org

1, 10, 100, 107, 109, 116, 118, 146, 158, 161, 164, 166, 170, 178, 181, 185, 187, 188, 190, 229, 239, 245, 254, 257, 269, 275, 277, 292, 293, 296, 299, 329, 338, 344, 356, 365, 368, 383, 386, 392, 407, 416, 425, 434, 443, 452, 455, 461, 467, 469, 470, 476
Offset: 0

Views

Author

Patrick De Geest, Nov 15 1999

Keywords

Examples

			107 is a term because 017 + 710 = 727 is prime.
		

Crossrefs

Cf. A052008.
Previous Showing 11-12 of 12 results.