Jump to content
BrainDen.com - Brain Teasers

superprismatic

Moderator
  • Posts

    1267
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by superprismatic

  1. the first number that repeats is the 49645th number (including the starting number), It's 655830144, and the pattern is 7087 numbers long.

    I think you're right because I get the exact same results as you.

    Did your algorithm use more than a few hundred bytes of memory

    for the variables? I'm more interested in *how* you did it than

    I am in the results.

  2. First repeating number: 464073344 [11340th term]

    Last repeating number: 470844180 [21796th term]

    Cycle length: 10457

    For reference, the first few terms I computed are:

    123456789

    417495654

    551879771

    933292867

    ...

    I get the same few terms as you have, but my program

    agrees with ksquared's results. I guess we'll have to

    wait until more people weigh in to see who's program

    is buggy!

  3. We define a sequence of numbers, all less than 1,000,000,000, in

    the following way:

    We start with the number 123,456,789. If our current number

    is N, the next number in the series is

    ((732,891,011 * floor(N/60)) + 345,678,911) modulo 1,000,000,000

    where "floor(x)" is the largest integer less than or equal to x

    (in other words, the integer part of x), and

    "y modulo 1,000,000,000" is simply the 9 least significant digits

    of y (in other words, the remainder after you divide y by

    1,000,000,000).

    Now, because the numbers in this sequence are all less than

    1,000,000,000 , the sequence must eventually fall into a repeating

    cycle of numbers. What is the length of this cycle?

    Feel free to write a program to compute this. Or even give

    a description of the algorithm such a program should use. Try

    not to use any large arrays in the program.

  4. Bob is walking down the street in the middle of the night, and he starts to get the feeling of being watched. Not just being watched-being followed! He starts to get scared, but then the glowing eyes give it away. It has razor sharp teeth and claws to match, and I really don't think you'd want to get it angry. It's hearing is better than most dogs, and it can see you even if it's pitch black. it can hunt down and kill more than a hundred different species of animals, and worst of all, it's a world conqueror. It has already taken over six of the seven continents! But surprisingly, Bob isn't scared. In fact, he picks it up!!! Is he crazy, or does he know something I haven't told you?

    Bob might be crazy -- I can't really say. But....

    Insect-eating bat!

  5. Terry71 is right!

    1). Ignore the K and the 10 in the happiness equation. That means we must optimize m^0.9*s^0.2*g^1.6.

    2). 10m+s+50g <= 800. Since we can always get to exactly $800 by increasing s, let's say 10m+s+50g=800. Therefore, s=800-10m-50g.

    3). To comply with the 50% rule, m<=40, g<=8, m+5g>=40.

    4). Within these constraints, find the best combination of m and g to maximize m^0.9*g^1.6*[10(80-m-5g)]^0.2.

    By trial and error, you get m=33, g=8, s=70.

    I dislike "trial and error" if more improvements can be made on it!

    Foolonthehill has the right idea, but I can't follow

    his differentiation. Anyway, the function he wants

    to maximize (after substitution for s) is

    f(m,g) = m^0.9 * g^1.6 * (80-5g-m)^0.2

    The constant K doesn't matter and the powers of 10

    also don't matter because maximizing 10^a * f(m,g) + K

    is the same as finding an m and a g which maximize

    f(m,g). So, we do both partial derivatives and

    set them each to zero and solve the resulting 2

    linear equations in m and g. This gives us a putative

    answer. But we must also try the extreme points of

    f(m,g), that is, the points where g is 8, g is 1,

    m is 40, and m is 1. It turns out that the g=8

    extreme point gives the highest score:

    When g=8, we maximize m^0.9 * 8^1.6 * (40-m)^0.2.

    Differentiating this with respect to m, we get

    8^1.6 * [(.9 * m^-.1 * (40-m)^0.2) - (.2 * m^.9 * (40-m)^-0.8)].

    Setting this equal to 0 and solving for m, we get m=(360/11),

    which has closest integer 33. This has the largest score

    of the 5 solutions we must try (the 4 extreme points plus

    the interior solution). So, the solution is: g=8, m=33, and

    s=70.

  6. Here's a more concrete solution based on my

    previous post

    If the numbers are in base 11 (the only base other

    than 10 which has all positive numbers in the

    pyramid), the pyramid is:

    A2

    47, 56

    19, 29, 28

    7, 12, 17, 11

    1, 6, 7, 10, 1

  7. Suppose the numbers are written in base x notation.

    First of all, x>9 since there's a 19 in the puzzle.

    Converted to base 10 (which we all love and cherish),

    the puzzle can be filled out (top-to-bottom and

    left-to-right with: 9x+13, 4x+7, 5x+6, x+9, 3x-2,

    2x+8, 7, x+2, 2x-4, 12, 12-x, x-5, 7, 2x-11, and

    23-2x.

  8. Agree with what K-man wrote (not completely though).

    I worked slightly differently and found that although both strategies give the same expected benefit of 10 cents, the sequence of looking into A1, A2 then switching to B1 to B5 and back to A1 to A5 gives a positive expected outcome for first 6 boxes checked while the strategy of looking into A1 then switching to B1 to 5 and back to A1 to 5 has only first 5 boxes that give positive expected result. See attached figs.

    Nice way to think of it, especially if there were some slight bias in which box is chosen for the $14. If there were such a bias, the two strategies would almost surely lead to different expected payoffs!

  9. I like this puzzle! :thumbsup: Even though it's not very difficult it has an answer that is not intuitive.

    At first I thought that the best approach would be going through one stack and if the money is not found go through another stack. With this strategy you will spend $14.50 on average if you play long enough, so it's a losing strategy. Since the money is randomly placed in one of the boxes the probability of any box containing the money is equal. Here are the possible outcomes with this strategy:

    A1: $1

    A2: $3

    A3: $6

    A4: $10

    A5: $15

    B1: $16

    B2: $18

    B3: $21

    B4: $25

    B5: $30

    The average of these outcomes is $14.50.

    I found 2 other strategies that are equally good and will win $.10 per play on average. In other words on average they cost $13.90 to play. Basically, the idea is that you take to top box (or top 2 boxes) from one stack and if the the money isn't there you go through another stack before going back thorough the first. Here are the outcomes and the sequences:

    Try A1, then go through B stack and finally back to A:

    A1: $1

    B1: $2

    B2: $4

    B3: $7

    B4: $11

    B5: $16

    A2: $19

    A3: $22

    A4: $26

    A5: $31

    Try A1 and A2, then go through B stack and finally back to A:

    A1: $1

    A2: $3

    B1: $4

    B2: $6

    B3: $9

    B4: $13

    B5: $18

    A3: $24

    A4: $28

    A5: $33

    As I already stated both these strategies average $13.90.

    Attempting to continue this pattern and try 3 boxes from A before going to B will cost you $14.20 per play.

    ^_^

    Nicely done, k-man! It's interesting to note that there are also 2 best solutions when there are 5 stacks of sizes 1,2,3,4, and 5. I wonder if there are always 2 for N stacks of sizes 1,2,3,...,N. Hmmmm.............

  10. Ah, this is quite easy. The top two boxes average the best profit, which are the only two profitable ones. Meaning A1 and B1.

    Every box has 10% to contain the riches, meaning on average every box is worth 1.4 dollars. The only boxes worth the risk on prolonged tries are the top ones. Top boxes average a .4 dollar profit each try, so it means, that the top two boxes profit .8 dollars per game on average. That's the best you'll get :D

    You can't stop playing the game whenever you want. The statement "you must pay to inspect boxes (explained in the next paragraph) until you find, and get to keep, the $14" was meant to mean exactly that. So, you have to keep playing (and paying) until you find the $14. Sorry.

  11. Consider the following game:

    There are 10 opaque boxes with labels

    A1, A2, A3, A4, A5, B1, B2, B3, B4, and B5.

    One of the boxes is chosen at random and

    $14 is placed inside of it. The other boxes

    contain nothing. The boxes are then stacked

    in 2 stacks -- boxes A1, A2, A3, A4, and A5

    are arranged in order into stack A with A1 on

    top; similarly, boxes B1, B2, B3, B4, and B5

    are arranged in order into stack B with B1 on

    top. To play this game, you must pay to

    inspect boxes (explained in the next paragraph)

    until you find, and get to keep, the $14.

    You may only take boxes from the top

    of a stack and pay, in dollars, whatever

    numeral is on its label. You may then either

    take (and pay appropriately for) the next box

    in that stack or switch to the other stack.

    BUT, if you switch to the other stack, you must

    restore the stack you have been using to its

    original order before doing so. You must pay

    for every box which you take off any stack

    even if you had previously paid for it. The

    game ends when you find (and get to keep) the

    $14.

    What is the best strategy for playing

    this game? If you follow the best strategy

    with every play, how much, on average, would

    you expect to win on each play?

  12. My wife and I went to a party with 4 other married couples (10 people in all). Each pair of persons who did not know each other were introduced. At the end of the party, I asked each of the other nine people there how many people they were introduced to. To my great surprise, I got all 9 possible answers -- 0,1,2,3,4,5,6,7, and 8. How many people was my wife introduced to?

  13. There is a sure way to do it, but it's pretty geeky!

    There are 242,519,269,720,337,121,015,504 ways to place 25 balls under 100 jars. That 24-digit number can be written as a 78-bit binary number. So, you can give each combination of 25 balls under 100 urns a serial number which is 78 bits long. That's 2-bits for each of the 39 prisoners. So each prisoner can have 2 bits out of this 78 bit number. There are 4 possibilities for each 2 bit chunk -- 00, 01, 10, and 11. They must agree on which words represent which 2-bit chunks. So, now the 40th prisoner can reconstruct the 78-bit serial number and reconstruct the room A combination of balls under the urns in his room B. This proves that they *can* solve the problem and live. There might be a more elegent procedure, though!

  14. or any embassy - I think you mean the charity/membership type order not a sovereignty/orincipality or 'country' of any kind ... point out if i'm wrong

    pls note in my signature the bit about spoilers

    FanQ

    Not like an embassy at all! In 1869, it was granted extraterritoriality by Italy. Today, it is recognized by more than 100 countries as the independent headquarters of a sovereign entity, with mutual diplomatic relations established. It even has it's own currency, the Scudo. If that isn't a country, I don't know what is!

×
×
  • Create New...