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.

A383666 Numbers in whose binary representation no bit (0 or 1) occurs exactly once.

Original entry on oeis.org

3, 7, 9, 10, 12, 15, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 60, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86
Offset: 1

Views

Author

Clark Kimberling, May 07 2025

Keywords

Comments

Also numbers that are not a power of 2 and are not (2^k + 1) away from the next larger power of 2 for some k. - David A. Corneth, May 17 2025

Examples

			From _David A. Corneth_, May 17 2025: (Start)
3 = 11_2 is in the sequence as both the digits 0 and the digits 1 do not occur exactly once in the binary expansion. Also 3 is no power of 2 and one less than a power of 2.
6 = 101_2 is not in the sequence as the digit 0 occurs exactly once in the binary expansion. Also it can be written as 2^3 - 2^0 - 1. (End)
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local L,n1,n0;
      L:= convert(n,base,2);
      n1:= convert(L,`+`);
      n0:= nops(L)-n1;
      n1 >= 2 and n0 <> 1
    end proc;
    select(filter, [$1..1000]); # Robert Israel, May 13 2025
  • Mathematica
    s = Select[Range[200], DigitCount[#, 2, 0] != 1 && DigitCount[#, 2, 1] != 1 &]
    Map[First, RealDigits[s, 2]]
  • PARI
    isok(k) = my(b=binary(k)); (#select(x->(x==1), b) != 1) && (#select(x->(x==0), b) != 1); \\ Michel Marcus, May 13 2025
    
  • PARI
    is(n) = {
        my(v = valuation(n, 2));
        if(n >> v == 1, return(0));
        if(1<> valuation(c, 2) == 1, return(0));
        1
    } \\ David A. Corneth, May 17 2025
    
  • PARI
    upto(n) = {
        my(res = [1..n], del = List());
        for(i = 0, logint(n, 2)+1,
            pow2 = 1<David A. Corneth, May 17 2025
    
  • Python
    def A383666(n):
        def f(x):
            if x<=1: return n+x
            l, s = x.bit_length(), bin(x)[2:]
            if (m:=s.count('0'))>0: return n+s.index('0')-(m>1)+(l*(l-1)>>1)
            return n-1+(l*(l+1)>>1)
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, May 21 2025