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

Home > Numbers
Top 40 (Posted on 2009-01-29) Difficulty: 4 of 5
On this week's list of the top 40 pop songs, last week's #35 is no longer on the list and a new song has appeared in the #32 position.

Positions 1, 23, 29, 31 and 37 have remained the same.

Each other song on last week's list has moved by an amount that is a factor, greater than 1, of last weeks position itself (including the possibility that the movement is in fact the same as last week's position).

If 18 of the 34 that moved moved up, and 16 moved down, what are the new positions of the songs listed by their position last week?

  Submitted by Charlie    
Rating: 4.5000 (2 votes)
Solution: (Hide)
last this
week week
 1    1 x
 2    4
 3    6
 4    2
 5   10
 6    3
 7   14
 8   16
 9   18
10    5
11   22
12    9
13   26
14    7
15   12
16    8
17   34
18   15
19   38
20   25
21   28
22   11
23   23 x
24   27
25   20
26   13
27   24
28   21
29   29 x
30   33
31   31 x
32   40
33   30
34   17
35    0
36   39
37   37 x
38   19
39   36
40   35

Non-movers marked with an x. Assumption here is that a lower number is higher on the chart.

DECLARE SUB place (p!)
CLEAR , , 25000

DIM SHARED used(40), h(40), downCt, upCt
used(1) = 1: h(1) = 1
used(23) = 1: h(23) = 23
used(29) = 1: h(29) = 29
used(31) = 1: h(31) = 31
used(32) = 1
used(37) = 1: h(37) = 37

place 2

SUB place (p)
  FOR mov = 2 TO p
    IF p MOD mov = 0 THEN
      try = p - mov
      IF try > 0 THEN
        IF used(try) = 0 THEN
          used(try) = 1
          h(p) = try
          upCt = upCt + 1
          SELECT CASE p
            CASE 22, 28, 30, 34, 36
             place p + 2
            CASE 40
             IF downCt = 16 AND upCt = 18 THEN
              FOR i = 1 TO 40
                PRINT USING "## ## "; i; h(i);
                IF i = h(i) THEN PRINT "x":  ELSE PRINT
              NEXT
              PRINT downCt, upCt
             END IF
            CASE ELSE
             place p + 1
          END SELECT
          upCt = upCt - 1
          h(p) = 0
          used(try) = 0
        END IF
      END IF
      try = p + mov
      IF try < 41 THEN
        IF used(try) = 0 THEN
          used(try) = 1
          h(p) = try
          downCt = downCt + 1
          SELECT CASE p
            CASE 22, 28, 30, 34, 36
             place p + 2
            CASE 40
             IF downCt = 16 AND upCt = 18 THEN
              FOR i = 1 TO 40
                PRINT USING "## ## "; i; h(i);
                IF i = h(i) THEN PRINT "x":  ELSE PRINT
              NEXT
              PRINT downCt, upCt
             END IF
            CASE ELSE
             place p + 1
          END SELECT
          downCt = downCt - 1
          h(p) = 0
          used(try) = 0
        END IF
      END IF
    END IF
  NEXT
END SUB

Adapted from Giant Book of Mensa Mind Challenges, edited by Todd Johnson, "Nearly Impossible Brain Bafflers" chapter, page 176: puzzle #26.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Pocket full of wryed bottemiller2009-01-30 21:21:03
Sing a Song of Sixpence...ed bottemiller2009-01-30 21:01:43
re(2): SolutionSing4TheDay2009-01-30 13:37:01
re(2): Solutionrod hines2009-01-29 19:24:09
re: SolutionCharlie2009-01-29 18:08:59
re: SolutionCharlie2009-01-29 17:46:01
Solutionrod hines2009-01-29 17:24:05
re: Also: clarificationsCharlie2009-01-29 14:30:25
SolutionSolutionSing4TheDay2009-01-29 13:53:07
Also: clarificationsed bottemiller2009-01-29 13:17:31
QuestionMoving on up? (clarification request)Steve Herman2009-01-29 12:11:31
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 (5)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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