OFFSET
1,2
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
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..10000
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
base,nonn,tabf
AUTHOR
Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Nov 06 2001
EXTENSIONS
Edited by Franklin T. Adams-Watters, Apr 09 2010
STATUS
approved