Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A161822
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A161822 a(n) = the smallest positive integer such that both n and a(n), when represented in binary, contain the same types of runs of 0's, the runs being in any order. +0
5
1, 2, 1, 4, 2, 2, 1, 8, 4, 10, 2, 4, 2, 2, 1, 16, 8, 18, 4, 18, 10, 10, 2, 8, 4, 10, 2, 4, 2, 2, 1, 32, 16, 34, 8, 36, 18, 18, 4, 34, 18, 42, 10, 18, 10, 10, 2, 16, 8, 18, 4, 18, 10, 10, 2, 8, 4, 10, 2, 4, 2, 2, 1, 64, 32, 66, 16, 68, 34, 34, 8, 68, 36, 74, 18, 36, 18, 18, 4, 66, 34, 74, 18 (list; graph; listen)
OFFSET

1,2

COMMENT

Clarification of definition: Think of binary n and a(n) each as a string of 0's and 1's. Consider the "runs" of 0's in binary n and a(n), where each run is made up completely of 0's, and is bounded on both sides either by 1's or by the edge of the string. Now consider the lengths of each bounded run of 0's (the number of 0's in each run). Then a(n) is the smallest positive integer whose set of run-lengths is a permutation of the set of run-lengths for n. (See example.)

1 <= a(n) <= n. a(n) = n iff n = 2^m for some m. a(n) = 1 iff n = 2^m - 1 for some m. [From Hagen von Eitzen (math(AT)von-eitzen.de), Jun 22 2009]

EXAMPLE

84 in binary is 1010100. There are three runs of 0's, two runs of one 0 each and one run of two 0's. So we are looking for the smallest positive integer with two runs of one 0 each and one run of two 0's (and no other runs of 0's). For example, 16 in binary is 10000, which contains the runs, except that it is required that each run be bounded by 1's or the edge of the binary string. The next number that fits the requirements completely is 74 = 1001010 in binary. So a(84) = 74.

PROGRAM

(PARI) a(n)=local(B=binary(n), L=[], ct=0); forstep(i=#B, 1, -1, if(B[i], if(ct, L=concat(L, ct); ct=0), ct++)); L=vecsort(L); forstep(i=#L, 1, -1, ct=(ct*2+1)*2^L[i]); if(ct>0, ct, 1) [From Hagen von Eitzen (math(AT)von-eitzen.de), Jun 22 2009]

CROSSREFS

A161819, A161820, A161821

Sequence in context: A120025 A109090 A080100 this_sequence A001176 A136693 A086685

Adjacent sequences: A161819 A161820 A161821 this_sequence A161823 A161824 A161825

KEYWORD

base,nonn

AUTHOR

Leroy Quet (q1qq2qqq3qqqq(AT)yahoo.com), Jun 20 2009

EXTENSIONS

More terms from Hagen von Eitzen (math(AT)von-eitzen.de), Jun 22 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 20 00:58 EST 2009. Contains 171054 sequences.


AT&T Labs Research