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

Home > Numbers
Non-Multiples (Posted on 2009-02-10) Difficulty: 3 of 5
Choose 25 different positive integers no higher than fifty, such that none is a multiple of any of the others. What's the lowest total possible, and what's the set? (Note one such set would be 26 through 50 inclusive; however that set totals 950.)

  Submitted by Charlie    
No Rating
Solution: (Hide)
The numbers are

8 12 14 17 18 19 20 21 22 23 25 26 27 29 30 31 33 35 37 39 41 43 45 47 49

totaling 711.

DECLARE SUB choose (n!)
CLEAR , , 25000
OPEN "nonmult.txt" FOR OUTPUT AS #2
DIM SHARED amt(25), mini(25)


mini(0) = 99999
choose 1
FOR i = 1 TO 25
  PRINT mini(i);
NEXT
PRINT mini(0)

CLOSE
END

SUB choose (n)
 IF n = 1 THEN st = 1:  ELSE st = amt(n - 1) + 1
 IF n = 3 THEN PRINT amt(1); amt(2)
 FOR try = st TO 25 + n
   good = 1
   FOR i = 1 TO n - 1
     IF try / amt(i) = INT(try / amt(i)) THEN
        good = 0: EXIT FOR
     END IF
   NEXT
   IF good THEN
    amt(n) = try
    IF n = 25 THEN
      tot = 0
      FOR i = 1 TO 25
        PRINT amt(i);
        PRINT #2, amt(i);
        tot = tot + amt(i)
      NEXT
      PRINT : PRINT tot
      PRINT #2, : PRINT #2, tot
      IF tot < mini(0) THEN
        FOR i = 1 TO 25
           mini(i) = amt(i)
        NEXT
        mini(0) = tot
      END IF
    ELSE
      choose n + 1
    END IF
   END IF
 NEXT try
END SUB

				

Comments: ( You must be logged in to post comments.)
  Subject Author Date
SolutionPuzzle SolutionK Sengupta2022-05-19 23:04:02
SolutionconfirmedEigenray2009-02-12 12:19:46
bottom uped bottemiller2009-02-10 20:52:07
Some ThoughtssmallishJer2009-02-10 15:16:24
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 (21)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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