All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers > Sequences
A Bit of a Problem (Posted on 2004-12-07) Difficulty: 3 of 5
Find the pattern of the following sequence and determine the next few terms:
2, 10, 12, 38, 42, 52, 56, 142, 150, 170

See The Solution Submitted by DJ    
Rating: 4.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re: Hints | Comment 7 of 17 |
(In reply to Hints by DJ)

Continuing Larry's solution yields the same numbers as in DJ's hint:

2 :10                   1 , 0
10 :1010                2 , 1
12 :1100                3 , 0
38 :100110              4 , 3
42 :101010              5 , 2
52 :110100              6 , 1
56 :111000              7 , 0
142 :10001110           8 , 7
150 :10010110           9 , 6
170 :10101010           10 , 5
178 :10110010           11 , 4
204 :11001100           12 , 3
212 :11010100           13 , 2
232 :11101000           14 , 1
240 :11110000           15 , 0
542 :1000011110         16 , 15
558 :1000101110         17 , 14
598 :1001010110         18 , 13
614 :1001100110         19 , 12
666 :1010011010         20 , 11
682 :1010101010         21 , 10
722 :1011010010         22 , 9
738 :1011100010         23 , 8
796 :1100011100         24 , 7
812 :1100101100         25 , 6
852 :1101010100         26 , 5
868 :1101100100         27 , 4
920 :1110011000         28 , 3
936 :1110101000         29 , 2
976 :1111010000         30 , 1

produced by the program

n1 = 1
n2 = 0
FOR n1 = 1 TO 30
 n1$ = ""
 n = n1
 DO
  n1$ = LTRIM$(STR$(n MOD 2)) + n1$
  n = n \ 2
 LOOP UNTIL n = 0
 IF INSTR(MID$(n1$, 2), "1") = 0 THEN
  n2 = n1 - 1
 ELSE
  n2 = n2 - 1
 END IF
 n2$ = ""
 n = n2
 DO
  n2$ = n2$ + LTRIM$(STR$(n MOD 2)) ' made in reverse
  n = n \ 2
 LOOP UNTIL n = 0
 DO UNTIL LEN(n2$) = LEN(n1$)
    n2$ = n2$ + "0"
 LOOP
 n = 0: n$ = n1$ + n2$
 FOR i = 1 TO LEN(n$)
  n = 2 * n + VAL(MID$(n$, i, 1))
 NEXT
 PRINT n; ":"; n$; TAB(25); n1; ","; n2
NEXT

As a measure of complexity, a subjective matter, this program is longer than the program which produced my interpretation.


  Posted by Charlie on 2004-12-09 19:57:42
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information