Recent Updates Page 67 Toggle Comment Threads | Keyboard Shortcuts

  • Unknown's avatar

    Jim Randell 11:49 am on 12 February 2019 Permalink | Reply
    Tags:   

    Teaser 2784: Three lives 

    From The Sunday Times, 31st January 2016

    → See: [ Teaser 2784: Three lives at Enigmatic Code ]

    [teaser2784]

     
  • Unknown's avatar

    Jim Randell 11:44 am on 12 February 2019 Permalink | Reply
    Tags:   

    Teaser 2779: New Year Party 

    From The Sunday Times, 27th December 2015

    → See: [ Teaser 2779: New Year Party at Enigmatic Code ]

    [teaser2779]

     
  • Unknown's avatar

    Jim Randell 11:41 am on 12 February 2019 Permalink | Reply
    Tags:   

    Teaser 2773: King Lear III 

    From The Sunday Times, 15th November 2015

    → See: [ Teaser 2773: King Lear III at Enigmatic Code ]

    [teaser2773]

     
  • Unknown's avatar

    Jim Randell 11:37 am on 12 February 2019 Permalink | Reply
    Tags:   

    Teaser 2759: King Lear II 

    From The Sunday Times, 9th August 2015

    → See: [ Teaser 2759: King Lear II at Enigmatic Code ]

    [teaser2759]

     
  • Unknown's avatar

    Jim Randell 10:33 am on 12 February 2019 Permalink | Reply
    Tags: ,   

    Teaser 2503: [Cube reflections] 

    From The Sunday Times, 12th September 2010

    → See: [ Teaser 2503 at Enigmatic Code ]

    This puzzle was originally published with no title.

    [teaser2503]

     
  • Unknown's avatar

    Jim Randell 3:27 pm on 11 February 2019 Permalink | Reply
    Tags:   

    Teaser 2565: Red and black 

    From The Sunday Times, 20th November 2011 [link] [link]

    I have taken 10 cards and written a different digit on each one. Some of the cards are red and the rest are black. I have placed some of the red cards in a row to form a long number. Then I have moved the last card to the front to give me a larger number. In fact this larger number divided by the original one equals a digit on one of the black cards.

    What was the original number?

    [teaser2565]

     
    • Jim Randell's avatar

      Jim Randell 3:53 pm on 11 February 2019 Permalink | Reply

      This puzzle is similar Enigma 1036.

      Here is a Python program that solves it using a similar analysis.

      Run: [ @replit ]

      from enigma import (irange, nsplit, int2base, printf)
       
      # consider multipliers
      for k in irange(2, 9):
        q = 10 * k - 1
       
        # consider n digit numbers
        for n in irange(1, 8):
          p = 10 ** n - k
       
          # consider possible mobile digit d (different from k)
          for d in irange(0, 9):
            if d == k: continue
       
            # the corresponding n digit number x, is...
            (x, r) = divmod(d * p, q)
            if r != 0: continue
            # x has to be n different digits
            s = set(nsplit(x, n))
            if len(s) != n: continue
            # also different from d and k
            if d in s or k in s: continue
       
            printf("{x}{d} x {k} = {d}{x}", x=int2base(x, width=n))
      

      Solution: The original number is 230769.

      So we have:

      230769 × 4 = 923076

      If we allow leading zeros there is a further solution:

      076923 × 4 = 307692

      Like

      • Frits's avatar

        Frits 11:42 am on 29 October 2020 Permalink | Reply

        @Jim,

        Is the phrase “some of the red cards” the reason why “n” cannot be 9?

        from enigma import SubstitutedExpression, seq_all_different, nsplit, div
        
        # the alphametic puzzle
        p = SubstitutedExpression(
          [# solve J * ABCDEFGHI = IABCDEFGH, J is one of the black cards
           
           # the derived formula
           "div(I * (10**N - J), (10 * J - 1)) = ABCDEFGH",
           # all different numbers
           "seq_all_different(nsplit(ABCDEFGH) + (I, J))",
           
           "len(str(ABCDEFGH)) = N"
          ],
          answer="10 * ABCDEFGH + I, J, I * 10**N + ABCDEFGH",
          verbose=0,
          d2i=dict([(k, "IJN") for k in {0,1}]),
          distinct="",   # allow variables with same values
          #reorder=0,
        )
        
        # Print answer
        for (_, ans) in p.solve():
          print(f"{ans[0]} x {ans[1]} = {ans[2]}")
        
        # 230769 x 4 = 923076
        

        Like

  • Unknown's avatar

    Jim Randell 8:27 pm on 7 February 2019 Permalink | Reply
    Tags:   

    Teaser 2942: What do points make? 

    From The Sunday Times, 10th February 2019 [link] [link]

    In the Premier League table a team’s points are usually roughly equal to their goals scored (Burnley were an interesting exception in 2017-18). That was exactly the case in our football league after the four teams had played each other once, with 3 points for a win and 1 for a draw.

    A ended up with the most points, followed by B, C and D in that order. Fifteen goals had been scored in total, and all the games had different scores. The best game finished 5-0, and the game BvD had fewer than three goals.

    What were the results of B’s three games (in the order BvA, BvC, BvD)?

    [teaser2942]

     
    • Jim Randell's avatar

      Jim Randell 11:38 am on 8 February 2019 Permalink | Reply

      I think this puzzle could have been worded more clearly.

      I took the first part to mean we are looking for situations where each team has exactly the same number of points as the number of goals scored by that team. And that the “best game finished 5-0” means that that game had the most goals scored altogether (i.e. the other games had no more than 4 goals scored in total). I took the fact that all matches had different scores to mean that you couldn’t have (for example) one game with a score of 2-0 and another with a score of 0-2.

      This program uses the [[ Football() ]] helper class from the enigma.py library. It looks for possible games for a team that can give the same number of points as the number of goals scored by that team, and then chooses outcomes for the four teams that satisfy the remaining conditions of the puzzle. It runs in 340ms.

      Run: [ @replit ]

      from itertools import (product, combinations)
      from enigma import (defaultdict, Football, ordered, printf)
      
      # scoring system
      football = Football(games='wdl', points=dict(w=3, d=1))
      
      # possible scores (a 5-0 and then no more than 4 goals in any match)
      scores = dict()
      scores['w'] = set([(1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (2, 1), (3, 1)])
      scores['d'] = set([(0, 0), (1, 1), (2, 2)])
      scores['l'] = set((x, y) for (y, x) in scores['w'])
      
      # record possible games by points (= goals for)
      ss = defaultdict(list)
      
      # consider outcomes for three matches for team T against X, Y, Z
      for (TX, TY, TZ) in football.games(repeat=3):
      
        # make the table for team T
        T = football.table([TX, TY, TZ], [0, 0, 0])
      
        # make possible score lines that give "goals for" = "points"
        for (sTX, sTY, sTZ) in product(scores[TX], scores[TY], scores[TZ]):
      
          (fT, aT) = football.goals([sTX, sTY, sTZ], [0, 0, 0])
      
          if not (fT == T.points): continue
      
          ss[fT].append((sTX, sTY, sTZ))
      
      # choose possible points (= goals for) for A, B, C, D
      for (pA, pB, pC, pD) in combinations(sorted(ss.keys(), reverse=1), 4):
      
        # but points = goals for, and the total number of goals is 15
        if not (pA + pB + pC + pD == 15): continue
      
        # choose matches for B
        for (BA, BC, BD) in ss[pB]:
      
          # B vs D has less than 3 goals scored
          if not (sum(BD) < 3): continue
      
          # choose matches for A
          for (AB, AC, AD) in ss[pA]:
            if not (AB == BA[::-1]): continue
      
            # choose matches for C
            for (CA, CB, CD) in ss[pC]:
              if not (CA == AC[::-1] and CB == BC[::-1]): continue
      
              # check matches for D
              if not ((AD[::-1], BD[::-1], CD[::-1]) in ss[pD]): continue
      
              # all games have different scores
              s = set(ordered(*x) for x in (AB, AC, AD, BC, BD, CD))
              if not (len(s) == 6): continue
      
              # there is a 5-0 game
              if not ((0, 5) in s): continue
      
              printf("AB={AB} AC={AC} AD={AD} BC={BC} BD={BD} CD={CD}, A={pA} B={pB} C={pC} D={pD}")
      

      Solution: The scores in B’s games are: B vs A = 1-2; B vs C = 2-2; B vs D = 1-0.

      It turns out that the fact that there is a 5-0 game means that there are only 10 goals to distribute between the remaining 5 matches, and there are no further solutions if games with more than 4 goals scored are considered, so it is enough to know that there is a 5-0 score.

      If we allow “mirror” scores (e.g. one game with a score of 2-0 and another with a score of 0-2), then there are no further solutions either. (Although if we allow repeated scores then there are additional solutions).

      If we relax the conditions that the number of points is exactly the same as the number of goals scored then there are multiple solutions, even if they must be within 1 of each other.

      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