Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A163381
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A163381 a(n) = the (decimal equivalent of the) smallest integer that can be made by rotating the binary digits of n any number of positions to the left or right. a(n) in binary may contain fewer digits, after leading 0's are removed, than n written in binary has. +0
3
1, 1, 3, 1, 3, 3, 7, 1, 3, 5, 7, 3, 7, 7, 15, 1, 3, 5, 7, 5, 11, 11, 15, 3, 7, 11, 15, 7, 15, 15, 31, 1, 3, 5, 7, 9, 11, 13, 15, 5, 13, 21, 23, 11, 27, 23, 31, 3, 7, 11, 15, 13, 23, 27, 31, 7, 15, 23, 31, 15, 31, 31, 63, 1, 3, 5, 7, 9, 11, 13, 15, 9, 19, 21, 23, 19, 27, 29, 31, 5, 13, 21, 29 (list; graph; listen)
OFFSET

1,3

COMMENT

By rotating the binary digits of n, it is meant: Write n in binary without any leading 0's. To rotate this string to the right, say, by one position, first remove the rightmost digit and then append it on the left side of the remaining string. (So, the least significant digit becomes the most significant digit.) Here, leading 0's are not removed after the first rotation, so that each binary string being rotated has the same number of binary digits as n has.

EXAMPLE

13 in binary is 1101. Rotating this just once to the right, we get 1110, 14 in decimal. If we rotate twice to the right, we would have had 0111 = 7 in decimal. Rotating 3 times, we end up with 1011, which is 11 in decimal. Rotating 4 times, we end up at the beginning with 1101 = 13. 7 is the smallest of these, so a(13) = 7.

MATHEMATICA

Table[Min[FromDigits[ #, 2]&/@ NestList[RotateLeft, IntegerDigits[n, 2], Floor[Log[2, n]]]], {n, 255}] [From Wouter Meeussen (wouter.meeussen(AT)pandora.be), Jul 27 2009]

PROGRAM

(PARI) a(n)=local(k=#binary(n), m=2^k, t=n*(m+1)); vecmin(vector(k, x, (t\2^x)%m)) [From Hagen von Eitzen (math(AT)von-eitzen.de), Jul 27 2009]

CROSSREFS

Cf. A163380, A163382

Sequence in context: A061892 A038573 A151837 this_sequence A160123 A147610 A133579

Adjacent sequences: A163378 A163379 A163380 this_sequence A163382 A163383 A163384

KEYWORD

base,nonn

AUTHOR

Leroy Quet (q1qq2qqq3qqqq(AT)yahoo.com), Jul 25 2009

EXTENSIONS

More terms from Hagen von Eitzen (math(AT)von-eitzen.de) and Wouter Meeussen (wouter.meeussen(AT)pandora.be), Jul 27 2009

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified December 4 23:11 EST 2009. Contains 170347 sequences.


AT&T Labs Research