A065609 Positive m such that when written in binary, no rotated value of m is greater than m.
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
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.
Links
- Ivan Neretin, Table of n, a(n) for n = 1..10000
Crossrefs
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
Comments