Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A161821
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A161821 a(n) = the smallest integer > n 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
3, 5, 7, 9, 6, 11, 15, 17, 12, 21, 13, 19, 14, 23, 31, 33, 24, 20, 25, 37, 22, 26, 27, 35, 28, 43, 29, 39, 30, 47, 63, 65, 48, 40, 49, 73, 38, 41, 51, 69, 44, 85, 45, 50, 46, 53, 55, 67, 56, 52, 57, 75, 54, 58, 59, 71, 60, 87, 61, 79, 62, 95, 127, 129, 96, 80, 97, 72, 70, 81, 99 (list; graph; listen)
OFFSET

1,1

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 integer greater than n whose set of run-lengths is a permutation of the set of run-lengths for n. (See example.)

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 integer > 84 with two runs of one 0 each and one run of two 0's (and no other runs of 0's). For example, 88 in binary is 1011000, 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 149 = 10010101 in binary. So a(84) = 149.

MAPLE

rtype := proc(n) local rt, bdgs, pr, i, rl ; rt := [seq(0, i=1..40)] ; bdgs := convert(n, base, 2) ; pr := 1 ; for i from 1 to nops(bdgs) do if op(i, bdgs) = 0 then if pr = 1 then rl := 0 ; fi; rl := rl+1 ; else if pr = 0 then rt := subsop(rl=op(rl, rt)+1, rt) ; fi; fi; pr := op(i, bdgs) ; if i = nops(bdgs) and pr = 0 then rt := subsop(rl=op(rl, rt)+1, rt) ; fi; od: rt ; end: A161821 := proc(n) local rtn, a; rtn := rtype(n) ; for a from n+1 do if rtype(a) = rtn then RETURN(a) ; fi; od: end: seq(A161821(n), n=1..100) ; [From R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Jul 20 2009]

CROSSREFS

A161819, A161820, A161822

Sequence in context: A029657 A122641 A140977 this_sequence A139083 A139081 A007731

Adjacent sequences: A161818 A161819 A161820 this_sequence A161822 A161823 A161824

KEYWORD

base,nonn

AUTHOR

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

EXTENSIONS

More terms from R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Jul 20 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 1 19:22 EST 2009. Contains 167811 sequences.


AT&T Labs Research