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.

Showing 1-2 of 2 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

A271499 Positive numbers n such that the number of 1's in the binary expansion of n is not a power of 2.

Original entry on oeis.org

7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 31, 35, 37, 38, 41, 42, 44, 47, 49, 50, 52, 55, 56, 59, 61, 62, 63, 67, 69, 70, 73, 74, 76, 79, 81, 82, 84, 87, 88, 91, 93, 94, 95, 97, 98, 100, 103, 104, 107, 109, 110, 111, 112, 115, 117, 118, 119, 121, 122, 123, 124, 125, 126, 127, 131, 133, 134, 137, 138, 140
Offset: 1

Views

Author

N. J. A. Sloane, Apr 16 2016

Keywords

Examples

			127 = 1111111_2 has seven 1's, so is a term (this distinguishes the sequence from A235336).
		

Crossrefs

Complement of A143071.
Similar to but different from A075930, A235336 and A271500.

Programs

  • Mathematica
    Select[Range@ 140, ! IntegerQ@ Log2@ First@ DigitCount[#, 2] &] (* Michael De Vlieger, Apr 16 2016 *)
  • PARI
    lista(nn) = {for (n=1, nn, my(nbd = hammingweight(n)); if (!((nbd==1) || (nbd==2) || (ispower(nbd,,&k) && (k==2))), print1(n, ", ")););} \\ Michel Marcus, Apr 16 2016
    
  • Python
    A271499_list = [n for n in range(1,10**6) if bin(bin(n).count('1')).count('1') != 1] # Chai Wah Wu, Apr 16 2016
Showing 1-2 of 2 results.