• subscribe
November 20, 2007 12:00 AM

The Logical Puzzle

SQL Server Pro
InstantDoc ID #97277

November’s Puzzle: Crazy Sequence
We posted a lengthy puzzle involving a long number at our Web site (InstantDoc ID 97007). Have you been able to determine the next number in that sequence? Let n be the zero-based position of the number in the sequence (0, 1, 2, 3, …). The actual number in the sequence is n factorials of n—that is, 0, 1!, 2!!, 3!!!, and so on. The lengthy last number in the sequence is 3!!!, so the next number in the sequence is 4!!!!. It would probably be prudent not to include the actual number in this space, as it wouldn’t leave space for anything else.

December’s Puzzle: Minimum Number of Weights
Can you determine the minimum number of weights required to measure any integer weight in the range 1 through 100 pounds using a scale? Also, can you generalize your answer for a range 1 through n pounds?



ARTICLE TOOLS

Comments
  • Joseph
    5 years ago
    Dec 12, 2007

    Another solution to December's puzzle:
    FLOOR(LN(n) / LN(2) + 1)

    In T-SQL:
    DECLARE @n int;
    SET @n = 100;
    SELECT FLOOR(LOG(@n) / LOG(2) + 1);

    Weights used would be 1, 2, 4, 8, 16, 32, 64, ...

  • Iddo
    5 years ago
    Dec 06, 2007

    Sorry, I had an error in my previous comment - 0!!! is actually 1

  • Iddo
    5 years ago
    Dec 06, 2007

    A minor comment on November's puzzle – another possible solution can be n!!! :
    0!!!, 1!!!, 2!!!, 3!!!

    Solution to December's puzzle:
    1, 3, 9, 27, 81

    General answer for n pounds – a minimal set of X weights which satisfies :
    Min( sum (i^3) (as i=1 to X ) ) >= n

You must log on before posting a comment.

Are you a new visitor? Register Here