Updates from April, 2022 Toggle Comment Threads | Keyboard Shortcuts

  • Unknown's avatar

    Jim Randell 9:38 am on 19 April 2022 Permalink | Reply
    Tags:   

    Brain-Teaser 668: Sweepstakes sixfold 

    From The Sunday Times, 28th April 1974 [link]

    A party of six racegoers arrived on the course with precisely £6 each with which to speculate. There were six races on the card and six runners in each race, so they decided to hold sweepstakes among themselves on each of the six races, the stake being £1 per race per person.

    The runners in each race were numbered 1, 2, 3, 4, 5 and 6, and each of the racegoers drew one of these numbers out of a hat. Each player’s number remained the same throughout the six races. There were thus, in effect, six separate sweepstakes, the holder of the winning number drawing £6 on each race. To add a little interest to the proceedings it was arranged that the winner on any one of the races would be permitted to buy (at cost price of £1) one additional chance in one or more of the races subsequent to his win, from one of the other players. Only a player who had not yet had a win could sell his chance.

    At the conclusion of the events it transpired that three players had made a net profit; the holder of No. 1 who won £4, the holder of No. 5 who won £1, and the holder of No. 4. The holder of No. 2 lost £3, and the holder of No. 6 lost £6.

    Three winning chances were sold, but none of these by the holders of Nos 1, 4 and 5. The holder of No. 1 did not have any transaction with the holders of Nos 2 and 3. There were no dead-heats and no number appeared in the winner’s frame in consecutive races.

    What, in order, were the numbers of the six winning horses?

    This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.

    [teaser668]

     
    • Jim Randell's avatar

      Jim Randell 9:40 am on 19 April 2022 Permalink | Reply

      At the start of the races each participant has a profit of −6 (having bought the 6 tickets with their own number on).

      And in each race, the outcome for each participant is:

      +6 = no transaction, win (with own ticket)
      +5 = buy ticket, win (with own or bought ticket)
      +1 = sell ticket
      0 = no transaction, don’t win
      −1 = buy ticket, don’t win (with either ticket)

      And there are some additional restrictions: a +5 or −1 can only come after a +6, and a +1 cannot come after a +6.

      And we can use these facts to check that there is a sequence of viable outcomes for each participant (without this the following code takes a lot longer to run, but you can change valid() to always return True to try the slower version, but it will take a lot longer).

      This Python program looks for a viable sequence of winners and ticket transactions for each race. It runs in 4.28s.

      Run: [ @replit ]

      from enigma import (irange, subsets, product, diff, first, printf)
      
      # update a dictionary with given deltas
      def update(d, *kvs):
        d = d.copy()
        for (ks, v) in kvs:
          for k in ks:
            d[k] += v
        return d
      
      # find possible length k sequences that give total t
      def complete(k, t, f=0, ss=[]):
        xs = [[0, 1, 6], [-1, 0, 5, 6]][f]
        if k == 0:
          if t == 0:
            yield ss
        elif k == 1:
          if t in xs:
            yield ss + [t]
        else:
          # choose an outcome
          for x in xs:
            yield from complete(k - 1, t - x, f or (x == 6), ss + [x])
      
      # is there a valid completion?
      valid = lambda k, t, f: bool(first(complete(k, t, f)))
      
      # totals we are given (also #3 not >0; #4 >0)
      totals = { 1: 4, 5: 1,  2: -3, 6: -6 }
      
      # solve the puzzle
      # n = remaining races
      # vs = ticket values
      # m = money for each participant
      # ws = winning tickets for each race
      # ps = winning players for each race
      # bs = potential buyers
      def solve(n, vs, m, ws=list(), ps=list(), bs=set()):
        if n == 0:
          # check totals
          if not (m[4] > 0 and not (m[3] > 0) and all(m[k] == v for (k, v) in totals.items())): return
          # check three winning tickets were sold
          if not (sum(x != y for (x, y) in zip(ws, ps)) == 3): return
          # viable solution
          yield (m, ws, ps)
        else:
          # choose some buyers and sellers
          b = len(bs)
          for k in irange(0, min(b, 6 - b)):
            for (bs1, ss1) in product(subsets(bs, size=k), subsets(diff(vs, bs), size=k, select="P")):
              # determine who gets the winnings
              d = dict(zip(ss1, bs1))
              # but 1 did not have any transactions with 2 or 3
              if any(d.get(k, 0) == v for (k, v) in [(1, 2), (1, 3), (2, 1), (3, 1)]): continue
              # perform the transactions
              m1 = update(m, (bs1, -1), (ss1, +1))
              # at this point we can check the targets of any sellers are reachable
              if any(not valid(n - 1, totals[k] - m1[k], k in bs) for k in ss1 if k in totals): continue
      
              # choose a winner for the race
              for w in vs:
                # no consecutive winners
                if ws and ws[-1] == w: continue
                # has the winning ticket been sold?
                p = d.get(w, w)
                if p != w:
                  # winning ticket was sold, but not by 1, 4, 5
                  if w in {1, 4, 5}: continue
                  # and only 3 winning tickets were solve
                  if sum(x != y for (x, y) in zip(ws, ps)) > 2: continue
                # allocate the winnings
                m_ = update(m1, ([p], +6))
                bs_ = bs.union([p])
                # check all (non-seller) targets are reachable
                if any(not valid(n - 1, v - m_[k], k in bs_) for (k, v) in totals.items() if k not in ss1): continue
                # solve for the remaining races
                yield from solve(n - 1, vs, m_, ws + [w], ps + [p], bs_)
      
      # initial values
      vs = list(irange(1, 6)) # available tickets
      m = dict((k, -6) for k in vs) # initial amounts
      for (m, ws, ps) in solve(6, vs, m):
        printf("winning tickets = {ws}; profits = {m}", m=list(m[i] for i in vs))
      

      Solution: The numbers of the winning horses were: 5, 4, 2, 3, 2, 1.


      One scenario is:

      Initially: All on −6
      Race 1: 5 wins; #5 → 0
      Race 2: #5 buys 1; 4 wins; #1 → −5, #4 → 0, #5 → −1
      Race 3: #4 buys 1, #5 buys 2; 2 wins; #1 → −4, #2 → −5, #4 → −1, #5 → +4
      Race 4: #4 buys 3, #5 buys 1; 3 wins; #1 → −3, #3 → −5, #4 → +4, #5 → +3
      Race 5: #4 buys 2, #5 buys 1; 2 wins; #1 → −2, #2 → −4, #4 → +9, #5 → +2
      Race 6: #4 buys 3, #5 buys 2; 1 wins; #1 → +4, #2 → −3, #3 → −4, #4 → +8, #5 → +1

      There are alternative scenarios, in each we have (#3, #4) → (−4, +8) or (−5, +9).

      But in each scenario the winning tickets are (5, 4, 2, 3, 2, 1).

      Like

  • Unknown's avatar

    Jim Randell 9:44 am on 12 April 2022 Permalink | Reply
    Tags:   

    Brain-Teaser 687: Fair deal 

    From The Sunday Times, 15th September 1974 [link]

    From a normal pack of playing cards, Bill, George, Harry and Joe were each dealt an Ace, a King, a Queen, a Jack and a ten.

    Harry’s five cards were in three different suits and consisted of three red and two black cards.

    Joe’s five cards were also in three different suits, his Ace being in the same suit as his Queen, and his King in the same suit as his Jack.

    George held more than one black card.

    Bill’s five cards were all in the same suit.

    Harry held the King of spades, and Joe the ten of diamonds.

    What were the cards in George’s hand?

    This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.

    [teaser687]

     
    • Jim Randell's avatar

      Jim Randell 9:45 am on 12 April 2022 Permalink | Reply

      I used the [[ SubstitutedExpression ]] solver from the enigma.py library to fill out the suits of the cards.

      Here is the run file:

      #! python3 -m enigma -rr
      
      # assign values 0-3 (S=0; C=1; H=2; D=3) to:
      #
      #     A K Q J X
      #  B: a b c d e
      #  G: f g h i j
      #  H: k m n p q
      #  J: r s t u v
      
      SubstitutedExpression
      
      --base=4
      --distinct="afkr,bgms,chnt,dipu,ejqv"
      
      # red cards and black cards
      --code="red = lambda x: x > 1"
      --code="black = lambda x: x < 2"
      
      # H's cards were in 3 different suits
      "len({{k}, {m}, {n}, {p}, {q}}) == 3"
      # 3 red [and 2 black]
      "icount([{k}, {m}, {n}, {p}, {q}], red) == 3"
      
      # J's cards were in 3 different suits
      "len({{r}, {s}, {t}, {u}, {v}}) == 3"
      # suit of A is the same as Q
      "{r} = {t}"
      # suit of K is the same as J
      "{s} = {u}"
      
      # G has more than 1 black card
      "icount([{f}, {g}, {h}, {i}, {j}], black) > 1"
      
      # B's cards are in the same suit
      "{a} = {b}" "{b} = {c}" "{c} = {d}" "{d} = {e}"
      
      # H held KS (i.e. m = S = 0)
      --assign="m,0"
      
      # J held XD (i.e. v = D = 3)
      --assign="v,3"
      

      And then I wrote a short Python program to output the hands dealt.

      The whole thing runs in 64ms.

      Run: [ @replit ]

      from enigma import (SubstitutedExpression, join, printf)
      
      # load the run-file
      p = SubstitutedExpression.from_file("teaser687.run")
      
      # solve the puzzle
      for s in p.solve(verbose=0):
        # output hands
        printf("   A K Q J X")
        hand = lambda xs: join(("SCHD"[s[x]] for x in xs), sep=" ")
        printf("B: {h}", h=hand("abcde"))
        printf("G: {h}", h=hand("fghij"))
        printf("H: {h}", h=hand("kmnpq"))
        printf("J: {h}", h=hand("rstuv"))
        printf()
      

      Solution: George held: A♣, K♦, Q♣, J♠, 10♠.

      The complete set of hands is fully determined:

      B: A♥, K♥, Q♥, J♥, 10♥.
      G: A♣, K♦, Q♣, J♠, 10♠.
      H: A♦, K♠, Q♦, J♦, 10♣.
      J: A♠, K♣, Q♠, J♣, 10♦.

      Like

  • Unknown's avatar

    Jim Randell 9:44 am on 15 March 2022 Permalink | Reply
    Tags:   

    Brain-Teaser 661: The logical choice 

    From The Sunday Times, 10th March 1974 [link]

    Four members who hold office in the Logic Club approve of each other. They recently decided among themselves that next year each of the four would hold an office now held by one of the other three.

    Other members wanted to know whether this was legal and who was moving to which office. So we asked them to explain themselves under the Club’s Friday rules: these rules say that a member must either make two correct statements or two incorrect statements.

    We unfortunately forgot that we were questioning them on a Tuesday, when members may keep the Friday rules or break them, just as they please.

    The President said: “What we are doing is legal. The man who will be Chairman next year keeps the Friday rules on Tuesdays”.

    The Chairman said: “I am keeping the Friday rules. I shall not become Secretary next year”.

    The Secretary said: “The Treasurer will become President next year. I am not keeping the Friday rules”.

    The Treasurer said: “The man who will be Secretary next year does not keep the Friday rules on Tuesdays. What we are doing is legal”.

    Which of them will be next year’s Chairman? Which will be next year’s Treasurer? Is what they are doing legal?

    This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.

    [teaser661]

     
    • Jim Randell's avatar

      Jim Randell 9:45 am on 15 March 2022 Permalink | Reply

      If the questioning takes place on a Tuesday, where “members may keep the Friday rules (give two truth values the same) or break them (give two different truth values), just as they please”, to my mind this means the answers to the questions on a Tuesday can be any truth values, and we are none the wiser.

      I suspect we are meant to suppose that on a Tuesday the members either consistently keep the Friday rules (each pair of statements has the same truth value), or consistently break them (each pair of statements has one truth and one falsehood), and their pre-determined behaviour is known to the other officers. Then we can make progress.

      This Python program looks at all possible scenarios to find those which correspond to the described situation. It runs in 47ms.

      Run: [ @replit ]

      from enigma import (subsets, product, multiset, map2str, printf)
      
      # f = keeping Friday rules; x, y = statements
      check = lambda f, x, y: f == (x == y)
      
      # we can populate the following variables:
      #  j: map(current job -> new job);  p: map(new job -> current job)
      #  f: map(current job -> keeping Friday rules
      #  legal: boolean
      
      # collect results (<next C>, <next T>, <legal>)
      qs = multiset()
      
      # consider possible assignments
      people = (P, C, S, T) = "PCST"
      js = subsets(people, size=4, select="D")
      fs = subsets((0, 1), size=4, select="M")
      for (jv, fv, legal) in product(js, fs, (0, 1)):
        j = dict(zip(people, jv))
        p = dict(zip(jv, people))
        f = dict(zip(people, fv))
      
        # P: "is legal; next C keeps Friday rules
        if not check(f[P], legal, f[p[C]]): continue
        
        # C: "C is keeping Friday rules; C will not become S"
        if not check(f[C], f[C], j[C] != S): continue
      
        # S: "T will become P; S is not keeping Friday rules"
        if not check(f[S], j[T] == P, not f[S]): continue
      
        # T: next S does not keep Friday rules; is legal"
        if not check(f[T], not f[p[S]], legal): continue
        
        printf("[legal={legal} j={j} f={f}]", j=map2str(j, arr="->"), f=map2str(f))
        qs.add((p[C], p[T], legal))
      
      # output results
      for ((q1, q2, q3), n) in qs.most_common():
        printf("(1) {q1} -> C; (2) {q2} -> T; (3) legal = {q3} [{n} solutions]", q3=bool(q3))
      

      Solution:(1) The Secretary plans to become the next Chairman; (2) The President plans to become the next Treasurer; (3) It is not legal.

      The plan for the assignment of jobs is:

      P → T
      C → P
      S → C
      T → S

      They can choose to follow Friday rules or not as they wish, except P must be the opposite of S.

      Like

  • Unknown's avatar

    Jim Randell 8:47 am on 10 March 2022 Permalink | Reply
    Tags:   

    Brain-Teaser 682: Jigsaw 

    From The Sunday Times, 11th August 1974 [link]

    “Bend me your ears”, says Bell wittily at the pub. “I have here six cardboard squares all of different sizes and one extra rectangular piece, which is bigger than the smallest square but smaller than any of the other five”.

    “Now I fit them together as a jigsaw puzzle to make a complete rectangle. All the pieces measure an exact number of inches and nobody can make a smaller jigsaw out of any such seven pieces. Bigger and smaller, of course, means by areas”.

    “To help you I will tell you this table is 20 inches square, and the jigsaw, you can see, is smaller than that. For the first solution I shall be happy to award one pint”.

    What are the measurements of:

    (a) the six squares?
    (b) the extra piece?
    (c) the jigsaw?

    The setter is given as “the late W A Thatcher”.

    This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.

    [teaser682]

     
    • Jim Randell's avatar

      Jim Randell 8:48 am on 10 March 2022 Permalink | Reply

      This Python program uses the rectangle packing code rectpack.py, last seen in Teaser 2806.

      It considers possible values for the total area of the pieces, then sees if that area can be made from 6 squares and a rectangular piece, and then attempts to pack them into a rectangle that fits within the table.

      It runs in 261ms. (Internal runtime is 207ms).

      Run: [ @replit ]

      from enigma import (irange, inf, divisors_pairs, multiply, printf)
      from rectpack import (pack, output_grid)
      
      # construct a set of <k> square pieces and a rectangular piece of total area <t>
      # s = minimal side of square
      # rs = current rectangles
      def pieces(t, k, s=1, rs=[]):
        # are we done?
        if k == 0:
          if len(rs) > 1:
            # final piece is a rectangle, between the smallest squares
            if multiply(rs[0]) < t < multiply(rs[1]):
              for (x, y) in divisors_pairs(t):
                if x < y < 21:
                  yield rs + [(x, y)]
        else:
          # add in another square
          for x in irange(s, inf):
            x2 = x * x
            if t < k * x2 + 2: break
            yield from pieces(t - x2, k - 1, x + 1, rs + [(x, x)])
      
      # find a minimal solution
      def solve():
        # consider possible total areas
        for t in irange(93, 380):
          for (x, y) in divisors_pairs(t):
            if y > 20: continue
      
            for rs in pieces(t, 6):
              for ps in pack(y, x, rs):
                # output solution
                printf("t={t} x={x} y={y} -> {rs}")
                printf()
                output_grid(y, x, ps)
                printf()
      
                # we only need 1 packing
                return
      
      solve()
      

      Solution: (a) The six squares measure: 1×1, 4×4, 5×5, 6×6, 7×7, 8×8. (b) The extra piece is a 1×4 rectangle. (c) The jigsaw is 13×15.

      Here is the layout found by the program:

      Note that the 5×5, 4×4, 1×4 pieces form sub-rectangles that can be rearranged to give additional layouts.

      There are also solutions for a 15×17 jigsaw and a 17×19 jigsaw.

      Like

  • Unknown's avatar

    Jim Randell 9:57 am on 1 March 2022 Permalink | Reply
    Tags:   

    Brain-Teaser 907: Snakes & ladders 

    From The Sunday Times, 9th December 1979 [link]

    During my recent trip into the jungle, I came across a clearing, at the centre of which was a stone with the following design:

    On closer inspection, I saw that the small squares were numbered from 1 to 10 (left to right along the bottom row), then from 11 to 20 (right to left on the next row up), 21 to 30 (left to right on the third row up), and so on. The lines joined the following pairs of squares:

    13 & 32
    25 & 48
    35 & 54
    45 & 66
    63 & 88
    79 & 94

    My guide explained that it was a very old snakes and ladders board. However, due to the ravages of time, it was not possible to tell which of the six lines were snakes and which were ladders. Fortunately the guide knew a legend concerning the board, and he told it to me.

    Many years ago, the king of that region had a beautiful daughter, and offered her in marriage to the first man who could get from square 1 to square 100 in just one turn. After many young men had tried and failed, a handsome prince from a neighbouring country had his turn, and threw 12 consecutive sixes. As he stood on square 1 to start, the first six took him to square 7. The remaining sixes took him to square 100.

    Which of the lines are snakes?

    This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.

    It is also included in the book The Sunday Times Book of Brainteasers (1994).

    [teaser914]

     
    • Jim Randell's avatar

      Jim Randell 10:00 am on 1 March 2022 Permalink | Reply

      We start with 6 linked squares, but we don’t know which way they “teleport”.

      This Python program considers each roll of the dice, and progresses the player. If we reach an “unassigned” linked square we try both possible directions of teleportation. It runs in 49ms.

      Run: [ @replit ]

      from enigma import update, delete, printf
      
      # the linked squares
      links = [(13, 32), (25, 48), (35, 54), (45, 66), (63, 88), (79, 94)]
      
      # make a dict of potential "teleports"
      ps = dict()
      for (x, y) in links:
        ps[x] = y
        ps[y] = x
      
      # play the game
      # rs = remaining dice rolls
      # ps = potential teleports (src -> tgt)
      # ts = actual teleports (src -> tgt)
      # n = current position
      def solve(rs, ps, n=1, ts=dict()):
        # are we done?
        if not rs:
          if n == 100:
            yield (ts, ps)
        else:
          # add in the next roll
          n += rs[0]
          if n > 100: n = 100
          n = ts.get(n, n)
          # is it a potential teleport?
          t = ps.get(n)
          if t is not None:
            ps_ = delete(ps, [n, t])
            # choose to teleport
            yield from solve(rs[1:], ps_, t, update(ts, [(n, t)]))
            # choose not to teleport
            yield from solve(rs[1:], ps_, n, update(ts, [(t, n)]))
          else:
            # move on
            yield from solve(rs[1:], ps, n, ts)
      
      # solve for a finish in 12 throws of 6
      for (ts, ps) in solve([6] * 12, ps):
        for (s, t) in sorted(ts.items()):
          printf("{s} -> {t} {x}", x=("snake" if t < s else "ladder"))
        printf("remaining = {ps}")
        printf()
      

      Solution: The lines (32 → 13) and (66 → 45) are snakes.

      And the rest are ladders.

      So play proceeds:

      (6) 1 → 7
      (6) 7 → 13
      (6) 13 → 19
      (6) 19 → 25 (ladder) → 48
      (6) 48 → 54
      (6) 54 → 60
      (6) 60 → 66 (snake) → 45
      (6) 45 → 51
      (6) 51 → 57
      (6) 57 → 63 (ladder) → 88
      (6) 88 → 94
      (6) 94 → 100

      Like

  • Unknown's avatar

    Jim Randell 11:26 am on 22 February 2022 Permalink | Reply
    Tags: by: Dr A Alan Taylor   

    Brain-Teaser 673: Crux numerorum 

    From The Sunday Times, 9th June 1974 [link]

    Professor Digby-Nite was excavating near Hadrian’s Wall last summer when he came across a clay tablet inscribed with this diagram and the words “CRUX NUMERORUM”.

    The clues when translated read:

    Across:
    I. Multiple of XXXVII.
    II. Multiple of LXXIII.
    III. A non-prime factor of I down.

    Down:
    I. A square.
    II. Multiple of VII.
    III. Calpurnia’s age.

    How old was Calpurnia?

    This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.

    [teaser673]

     
    • Jim Randell's avatar

      Jim Randell 11:26 am on 22 February 2022 Permalink | Reply

      The grid is (of course) to be completed using Roman numerals.

      The following Python program runs in 50ms.

      Run: [ @replit ]

      from enigma import (int2roman, roman2int, irange, divisors, is_prime, catch, printf)
      
      # find length k romans
      def romans(ns, k=3):
        for n in ns:
          r = int2roman(n)
          if len(r) == k:
            yield r
      
      # multiples for i across
      n = roman2int('XXXVII')
      m1as = list(romans(irange(n, 5000, step=n)))
      
      # multiples for ii across
      n = roman2int('LXXIII')
      m2as = list(romans(irange(n, 5000, step=n)))
      
      # multiples for ii down
      n = roman2int('VII')
      m2ds = list(romans(irange(n, 5000, step=n)))
      
      # squares
      sqs = list(romans(i * i for i in irange(1, 70)))
      
      # i down (= ADG) is a square
      for (A, D, G) in sqs:
      
        # ii across is a multiple of 73
        for (D_, E, F) in m2as:
          if D_ != D: continue
      
          # i across is a multiple of 37
          for (A_, B, C) in m1as:
            if A_ != A: continue
      
            # ii down is a multiple of 7
            for (B_, E_, H) in m2ds:
              if B_ != B or E_ != E: continue
      
              # iii across is a non-prime factor of i down
              for (G_, H_, I) in romans(d for d in divisors(roman2int(A + D + G)) if not is_prime(d)):
                if G_ != G or H_ != H: continue
      
                # answer (must be valid roman)
                ans = catch(roman2int, C + F + I)
                if ans is None: continue
      
                # output solution
                printf("ans = {ans} [{A} {B} {C} / {D} {E} {F} / {G} {H} {I}]")
      

      Solution: Calpurnia is 19.

      The completed grid looks like this:

      Like

      • Jim Randell's avatar

        Jim Randell 1:54 pm on 22 February 2022 Permalink | Reply

        Manually:

        There is only one length 3 multiple of 73 (for II across):

        DXI = 511 = 7×73

        And there are only three length 3 squares (for I down):

        XVI = 16 = 4²
        XXV = 25 = 5²
        MDC = 1600 = 40²
        MMD = 2500 = 50²

        Of these, only MDC interlocks with DXI.

        There are only three length 3 multiple of 37 (for I across):

        CXI = 111 = 3×37
        DLV = 555 = 15×37
        MCX = 1110 = 30×37

        Of these, only MCX interlocks with MDC.

        Which leaves II down = “a multiple of VII” that matches “CX_”, it must be:

        CXL = 140 = 20×7

        And III across = “a non-prime divisor of 1600”, that matches “CL_”, it must be:

        CLX = 160 = 1600 / 10

        The grid is now complete and III down = XIX = 19.

        Like

  • Unknown's avatar

    Jim Randell 10:24 am on 15 February 2022 Permalink | Reply
    Tags:   

    Brain-Teaser 878: Four twos make …? 

    From The Sunday Times, 4th June 1978 [link]

    Two maths pupils had been indulging in the traditional “Four Fours” recreation, (i.e. seeing how many consecutive integers from 1 up they could express by means of a string of just four 4s with the signs for addition, subtraction, multiplication or division (to obviate numerator/denominator) interspersed as required, along with brackets where needed for clarity, but (according to their rules) featuring no power indices nor other aids except that each expression may use one decimal point. Examples illustrating all this are:

    18 = (4 / .4) + 4 + 4
    28 = 4 × (4 + 4) – 4

    As a variant they then tried working with 2s instead of 4s but soon found that there is a certain integer, lower than both of the above, which defeats every effort to express it with only four 2s. But when they used the minimum number of 2s to express it, they found, under corresponding conditions, that they could express it in a number of different ways. Indeed they found two ways which used neither addition nor multiplication.

    What were those two expressions?

    This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.

    [teaser878]

     
    • Jim Randell's avatar

      Jim Randell 10:24 am on 15 February 2022 Permalink | Reply

      See also: Teaser 1949-12-25.

      We can take the code for Teaser 1949-12-25, and change it to using four 2’s, and only the 4 basic mathematical operators.

      We find that we can generate all the numbers from 1 to 16:

      1 = 22 / 22
      2 = (2 / 2) + (2 / 2)
      3 = 2 + 2 − (2 / 2)
      4 = 2 + 2 + 2 − 2
      5 = 2 + 2 + (2 / 2)
      6 = (2 + 2) × 2 − 2
      7 = 2 + 2 / (2 × .2)
      8 = 2 + 2 + 2 + 2
      9 = (22 / 2) − 2
      10 = 22 / 2.2
      11 = (2 / .2) + (2 / 2)
      12 = (22 + 2) / 2
      13 = (22 / 2) + 2
      14 = (2 / .2) + 2 + 2
      15 = (2 + (2 / 2)) / .2
      16 = (2 + 2) × (2 + 2)
      17 = ???

      So we can’t express 17 using four 2’s. But as we can express 15 using four 2’s that means we can certainly express 17 using five 2’s:

      17 = ((2 + (2 / 2)) / .2) + 2

      But the question asks us to express it without using addition or multiplication:

      17 = 22 − ((2 / 2) / .2)
      17 = 22 − ((2 / .2) / 2)

      Like

  • Unknown's avatar

    Jim Randell 8:54 am on 1 February 2022 Permalink | Reply
    Tags:   

    Brain-Teaser 652: Stumped! 

    From The Sunday Times, 6th January 1974 [link] [link]

    The scoreboard at our local cricket ground shows the total number of runs scored, the number of wickets fallen and the scores of the two batsmen in at the time.

    At the match last Sunday we declared at 500 for 8 wickets, when our first man in had just reached 100 runs (I was the other opener and was already out for 20). The seventh batsman had also scored a century, and there were no ‘extras’ at all in the match (i.e. all the runs were scored by the batsmen).

    Some time after my dismissal I noticed that the scoreboard showed eight similar digits (e.g. 999 for 9, both men in having scored 99 each) and later the board showed eight consecutive digits in ascending order, though with 0 following 9 (e.g. 678 for 9; batsmen with 01 and 23).

    What were the two scores I had seen?

    This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.

    [teaser652]

     
    • Jim Randell's avatar

      Jim Randell 8:56 am on 1 February 2022 Permalink | Reply

      The innings was declared 500 for 8, so the options are:

      For scores greater between 20 and 500 we have:

      444 for 4, (44 and 44)
      333 for 3, (33 and 33)
      222 for 2, (22 and 22)
      111 for 1, (11 and 11)

      The last of these is not possible. If only one batsman has been dismissed, it is the setter for 20, so the total score would be 20 + 11 + 11 = 42, not 111.

      The second time the scoreboard could be showing (assuming the “in” scores can have a leading zero):

      456 for 7, (89 and 01)
      345 for 6, (78 and 90)
      234 for 5, (67 and 89)
      123 for 4, (56 and 78)

      Again the last of these is not possible, as the sum of the scores of the “in” batsmen is more than the total score.

      So we have the following potential observations:

      444 → 456
      333 → 345, 456
      222 → 234, 345, 456

      But some of these transitions are not possible.

      222 → 234 – only 12 more runs have been scored but the “in” scores have increased by 45 and 67 = 112
      222 → 345 – only 123 more runs have been scored, but the “in” scores have increased by 56 and 68 = 124
      333 → 345 – only 12 more runs have been scored, but the “in” scores have increased by 45 and 57 = 102
      444 → 456 – only 12 more runs have been scored, but one of the “in” scores has increased by 45

      Which leaves only the following transitions:

      333 → 456
      222 → 456

      Consider the “333 for 3” → “456 for 7” transition:

      Initially the score is “333 for 3”, and the “in” batsmen have both scored 33. So the 3 dismissed batsmen must have scored 267 between them. We know one of these is the setter, who scored 20. Which leaves 247 to be scored between the remaining 2 dismissed batsmen. We’ll distribute the runs as 123 and 124 run to batsmen 3 and 4:

      1: 33 (not out)
      2: 20 (out, setter)
      3: 123 (out)
      4: 124 (out)
      5: 33 (not out)

      By the time we get to “456 for 7”, the first batsman must have increased his score to 89, and the remaining “in” batsman has a score of 1 (let’s say this is batsman 9):

      1: 89 (not out)
      2: 20 (out, setter)
      3: 123 (out)
      4: 124 (out)
      5: ≥ 33 (out)
      6: ? (out)
      7: ≥100 (out)
      8: ? (out)
      9: 1 (not out)

      But these already sum to 490, which is more than 456, so this situation is not possible.

      Consider the “222 for 2” → “456 for 7” transition:

      Initially the score is “222 for 2”, and the “in” batsmen have both scored 22. So the 2 dismissed batsmen must have scored 178 between them, and we know one of them is the setter, who scored 20. So the other must have scored 158 (let’s say that was the 3rd batsman):

      1: 22 (not out)
      2: 20 (out, setter)
      3: 158 (out)
      4: 22 (not out)

      By the time we get to “456 for 7” the 1st batsman must have increased his score to 89, and the remaining “in” batsman has a score of 1 (let’s say this is batsman 9):

      1: 89 (not out)
      2: 20 (out, setter)
      3: 158 (out)
      4: ≥22 (out)
      5: ? (out)
      6: ? (out)
      7: ≥100 (out)
      8: ? (out)
      9: 1 (not out)

      This leaves 66 runs to distribute between 4, 5, 6, 7, 8. Which is possible.

      So this is the only possible situation.

      Solution: The two scores are: “222 for 2, (22 and 22)” and: “456 for 7, (89 and 01)”.

      Like

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
Design a site like this with WordPress.com
Get started