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.

A295235 Numbers k such that the positions of the ones in the binary representation of k are in arithmetic progression.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 21, 24, 28, 30, 31, 32, 33, 34, 36, 40, 42, 48, 56, 60, 62, 63, 64, 65, 66, 68, 72, 73, 80, 84, 85, 96, 112, 120, 124, 126, 127, 128, 129, 130, 132, 136, 144, 146, 160, 168, 170, 192, 224, 240, 248
Offset: 1

Views

Author

Rémy Sigrist, Nov 18 2017

Keywords

Comments

Also numbers k of the form Sum_{b=0..h-1} 2^(i+j*b) for some h >= 0, i >= 0, j > 0 (in fact, h = A000120(k), and if k > 0, i = A007814(k)).
There is a simple bijection between the finite sets of nonnegative integers in arithmetic progression and the terms of this sequence: s -> Sum_{i in s} 2^i; the term 0 corresponds to the empty set.
For any n > 0, A054519(n) gives the numbers of terms with n+1 digits in binary representation.
For any n >= 0, n is in the sequence iff 2*n is in the sequence.
For any n > 0, A000695(a(n)) is in the sequence.
The first prime numbers in the sequence are: 2, 3, 5, 7, 17, 31, 73, 127, 257, 8191, 65537, 131071, 262657, 524287, ...
This sequence contains the following sequences: A000051, A000079, A000225, A000668, A002450, A019434, A023001, A048645.
For any k > 0, 2^k - 2, 2^k - 1, 2^k, 2^k + 1 and 2^k + 2 are in the sequence (e.g., 14, 15, 16, 17, and 18).
Every odd term is a binary palindrome (and thus belongs to A006995).
Odd terms are A064896. - Robert Israel, Nov 20 2017

Examples

			The binary representation of the number 42 is "101010" and has ones evenly spaced, hence 42 appears in the sequence.
The first terms, alongside their binary representations, are:
   n  a(n)  a(n) in binary
  --  ----  --------------
   1    0           0
   2    1           1
   3    2          10
   4    3          11
   5    4         100
   6    5         101
   7    6         110
   8    7         111
   9    8        1000
  10    9        1001
  11   10        1010
  12   12        1100
  13   14        1110
  14   15        1111
  15   16       10000
  16   17       10001
  17   18       10010
  18   20       10100
  19   21       10101
  20   24       11000
		

Crossrefs

Cf. A029931, A048793 (binary indices triangle), A070939, A291166, A325328 (prime indices rather than binary indices), A326669, A326675.

Programs

  • Maple
    f:= proc(d) local i,j,k;
      op(sort([seq(seq(add(2^(d-j*k),k=0..m),m=1..d/j),j=1..d),2^(d+1)]))
    end proc:
    0,1,seq(f(d),d=0..10); # Robert Israel, Nov 20 2017
  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    Select[Range[100],SameQ@@Differences[bpe[#]]&] (* Gus Wiseman, Jul 22 2019 *)
  • PARI
    is(n) = my(h=hammingweight(n)); if(h<3, return(1), my(i=valuation(n,2),w=#binary(n)); if((w-i-1)%(h-1)==0, my(j=(w-i-1)/(h-1)); return(sum(k=0,h-1,2^(i+j*k))==n), return(0)))