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.

A065609 Positive m such that when written in binary, no rotated value of m is greater than m.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 8, 10, 12, 14, 15, 16, 20, 24, 26, 28, 30, 31, 32, 36, 40, 42, 48, 50, 52, 54, 56, 58, 60, 62, 63, 64, 72, 80, 84, 96, 98, 100, 104, 106, 108, 112, 114, 116, 118, 120, 122, 124, 126, 127, 128, 136, 144, 160, 164, 168, 170, 192, 194, 196, 200, 202
Offset: 1

Views

Author

Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Nov 06 2001

Keywords

Comments

Rotated values of m are defined as the numbers which occur when m is shifted 1, 2, ... bits to the right with the last bits added to the front; e.g., the rotated values of 1011 are 1011, 1101, 1110 and 0111.
The number of k-bit binary numbers in this sequence is A008965. This gives the row lengths when the sequence is regarded as a table.
If m is in the sequence, then so is 2m. All odd terms are of the form 2^k - 1. - Ivan Neretin, Aug 04 2016
First differs from A328595 in lacking 44, with binary expansion {1, 0, 1, 1, 0, 0}, and 92, with binary expansion {1, 0, 1, 1, 1, 0, 0}. - Gus Wiseman, Oct 31 2019

Examples

			14 is included because 14 in binary is 1110. 1110 has the rotated values of 0111, 1011 and 1101 -- 7, 11 and 13 -- which are all smaller than 14.
		

Crossrefs

A similar concept is A328595.
The version with the most significant digit ignored is A328668 or A328607.
Numbers whose reversed binary expansion is a Lyndon word are A328596.
Numbers whose binary expansion is aperiodic are A328594.
Binary necklaces are A000031.
Necklace compositions are A008965.

Programs

  • Maple
    filter:= proc(n) local L, k;
      if n::odd then return evalb(n+1 = 2^ilog2(n+1)) fi;
      L:= convert(convert(n,binary),string);
      for k from 1 to length(L)-1 do
        if not lexorder(StringTools:-Rotate(L,k),L) then return false fi;
      od;
      true
    end proc:
    select(filter, [$1..1000]); # Robert Israel, Aug 05 2016
  • Mathematica
    Select[Range[200], # == Max[FromDigits[#, 2] & /@ NestList[RotateLeft, dg = IntegerDigits[#, 2], Length@dg]] &] (* Ivan Neretin, Aug 04 2016 *)
  • Python
    def ok(n):
        b = bin(n)[2:]
        return b > "0" and all(b[i:] + b[:i] <= b for i in range(1, len(b)))
    print([k for k in range(203) if ok(k)]) # Michael S. Branicky, May 26 2022

Extensions

Edited by Franklin T. Adams-Watters, Apr 09 2010