Puzzles

Level I

  1. Read a number, then write it. So if you input 3, you should see 3.
  2. Read two numbers. Write the first one second and the second one first. So if you input 8 and 3, you should see 3 and 8.
  3. Read two numbers. Write their sum. Sum should also be in bucket E. So if you input 8 and 3, you should see 11, AND you should see 11 in bucket E.
  4. Read two numbers. Compute the difference (first number minus the second number). Now double that difference and write it. So if you input 8 and 3, you should see 10.
  5. Read three numbers. Display their average. So if you input 7, 3, and 2, you should see 4.
  6. Read a number (not zero and not one). Determine how you can get negative one in bucket C, zero in bucket D, and positive one in bucket E.
  7. Read four numbers into buckets A, B, C and D. Show ((A + B) * (C + D)) and store the result in bucket E. So if you input (2, 3, 4, 5) you should see 45, and if you input (3, 4, 5, 6) you should see 77 in the display and in bucket E.
  8. Demonstrate the associative property of addition: Read three numbers into buckets A, B and C. Compute and show (A + B), then compute and show (A + B) + C. Now compute and show (B + C), then compute and show A + (B + C). So if you input (2, 3, 4) you should see (5, 9, 7, 9). (You get 9 twice because the order of addition doesn't matter.) Then demonstrate the associative property of multiplication: Read three numbers into buckets A, B and C. Compute and show (A * B), then compute and show (A * B) * C. Now compute and show (B * C), then compute and show A * (B * C). So if you input (2, 3, 4) you should see (6, 24, 12, 24). (You get 24 twice because the order of multiplication doesn't matter.)
  9. Distributive property of multiplication: Read three numbers into buckets A, B and C. Compute and show (A + B) * C, then compute and show (A * C) + (B * C). So if you input (2, 5, 6) you should see 42 twice. If you input (2, 5, 0) you should see 0 twice. If you input (1, 1, 1) you should see 2 twice.
  10. Read two numbers. Store them in buckets A and B. Store their opposites (negatives) in buckets C and D. Show that the product of two negative numbers is equal to the product of their opposites; that is, show the product A * B and the product C * D. So if you enter 7 and 3, you should see 21 twice, with 7 in bucket A, 3 in bucket B, -7 in bucket C, and -3 in bucket D.

Level II

  1. Read two numbers. If the first is larger than the second, then display the difference, otherwise display the sum. So if you input 8 and 3, you should see 5. But if you input 3 and 8, you should see 11.
  2. Read two numbers. Write the largest first and the smallest second. So if you input 8 and 3, you should see 8 and 3. Likewise, if you input 3 and 8, you should still see 8 and 3.
  3. Read two numbers. Divide the first (dividend) by the second (divisor) and show the quotient, but only if the second (divisor) is not zero. If the second is zero, display that value instead. So if you input 12 and 4, you should see 3. But if you input 12 and 0, you should see 0.
  4. Read three numbers. Put the largest of the three in bucket D and the smallest of the two in bucket E. So if you input 5, 6, and 2, then you should end with 6 in bucket D and 2 in bucket E. Likewise, if you enter (5, 2, 6), (6, 5, 2), (6, 2, 5), (2, 5, 6), or (2, 6, 5), you should end with 6 in bucket D and 2 in bucket E.
  5. Note that BucketLogic uses integer division, which means that the remainder of a division operation is lost. Determine a way to get the remainder. So if you input (14, 4), you should see 2 (since 14 = (4 * 3) + 2). If you input (34, 5), you should see 4 (since 34 = (5 * 6) + 4). Careful! If the divisor is zero, you should just print zero.
  6. Read two numbers. If the first is evenly divisible by the second, then show 0, otherwise show 1. So if you input 8 and 4, you should see 0, but if you input 8 and 3 you should see 1.
  7. Read three numbers into A, B, anc C. Order them such that the lowest number is in A, the middle number is in bucket B, and the highest number is in bucket C. Then show the numbers in ascending order. So if you enter (3, 4, 5), (3, 5, 4), (4, 3, 5), (4, 5, 3), (5, 3, 4), or (5, 4, 3) you will you should see (3, 4, 5), and you should see 3 in bucket A, 4 in bucket B, and 5 in bucket C. Note: you’ll want to use the solution to this puzzle as a starting point for puzzles 8, 9, and 10!
  8. Three numbers cannot be the sides of a triangle is the largest is greater than or equal to the sum of the other two. Read three numbers. Show 0 if a triangle could be made from them, or -1 if a triangle cannot be made from them. So if you enter (3, 6, 4) you should see 0, but if you enter (3, 7, 4) or (3, 8, 4) you should see -1. If you enter (12, 4, 9) you should see 0, but if you enter (12, 4, 8) or (12, 4, 7) you should see -1.
  9. Pythagorean theorem: Read three numbers with the largest number last. If these numbers could be the sides of a right triangle (a2 + b2 = c2), then show 1. Otherwise, show 0. So if you enter (3, 5, 4), (5, 3, 4), (12, 5, 13) or (5, 13, 12) you should see 1, but if you enter (3, 4, 6), (3, 7, 5), (5, 12, 14) or (14, 5, 12) you should see 0.
  10. Modify the previous puzzle so that if the numbers cannot be a triangle, then show -1. So if you enter (3, 5, 4) or (13, 12, 5) you should see 1; if you enter (3, 6, 4) or (12, 5, 14) you should see 0; and if you enter (3, 7, 4) or (12, 5, 6) you should see -1.

Level III

  1. Read a number. Count forward from zero, displaying all numbers from zero to your number. Then count backwards, displaying all numbers from your number to zero. So if you input 3, you should see (0, 1, 2, 3, 3, 2, 1, 0).
  2. Read a number. Count forward from zero, displaying all even numbers from zero to your number. Then count backwards, displaying all numbers from your number to zero. So if you input 8 or 9, you should see (0, 2, 4, 6, 8, 8, 6, 4, 2, 0). Careful! If you input zero, you should see (0, 0).
  3. Read two numbers. Display all numbers between the lowest number and the highest number, forward and backwards. So if you input (2, 5), you should see (2, 3, 4, 5, 5, 4, 3, 2). If you input (6, 3), you should see (3, 4, 5, 6, 6, 5, 4, 3).
  4. Read a number, which is to indicate how many other numbers will be read. Read those numbers, and display their sum. So if you input (1, 2) you should see 2; if you input (2, 5, 9) you should see 14; if you input (3, 5, 6, 2), you should see 13. Careful! If you enter zero, you should see zero!
  5. Read two numbers. Show the first number raised to the power indicated by the second number, and store that value in bucket B. So if you enter (3, 4) you should see 81 in the display and in bucket B, but if you enter (4, 3) you should see 64 in the display and in bucket B. Careful! Any number raised to the zero power is one. (The value of zero to the zero power is the subject of some debate: just use one.)
  6. Read a series of numbers. Stop reading when zero is entered. Display the lowest and highest numbers read (not including zero.) So if you enter (2, 9, 6, 4, 0), you should see (2, 9). If you enter (18, 12, 15, 10, 20, 0), you should see (10, 12). If you enter (5, 0), you should see (5, 5). Careful! If you enter (0), you should see (0, 0).
  7. Read a number. Display all factors of that number. So if you enter 12, you should see (1, 2, 3, 4, 6). If you enter 13, you should see (1, 13). If you enter 14, you should see (1, 2, 7, 14).
  8. Read two numbers. Display their common factors, excluding zero and one. So if you enter (20, 30), you should see (2, 5, 10). If you enter (45, 60), you should see (3, 5, 15). If you enter (30, 75) you should see (3, 5, 15). If you enter 20 and 21 (which have no common factors other than one), you should see nothing.
  9. (Similar to #7 above.) Read a number. Display all factors of that number. If the number is prime, end with a 1 in bucket E, otherwise (the number is composite), end with a 0 in bucket E. So if you enter 12, you should see (1, 2, 3, 4, 6), and have 0 in bucket E. If you enter 13, you should see (1, 13) and have 1 in bucket E.
  10. Read a number. Display only the prime factors of that number. So if you enter 12, you should see (2, 3). If you enter 13, you should see 13. If you enter 147, you should see (3, 7). If you enter 67, you should see 67.

Please email your own puzzles to me at bill_qualls@hotmail.com. If approved, I will put your name and puzzle on this web site.

Copyright © 2009 by Bill Qualls.