Skip to content

Sunday Times Teaser 3068 – Valued Playwrights

by Brian Gladman on July 9, 2021

by Victor Bryant

Published Sunday July 11 2021 (link)

I have given each letter of the alphabet a different whole-number value from 1 to 26. For example, P=4, L=8, A=3 and Y=24. With my numbers I can work out the value of any word by adding up the values of its letters, for example the word PLAY has a value of 39.

It turns out that the playwrights:


all have the same prime value.

Also COWARD, PINERO and STOPPARD have prime values.

What are these three prime numbers?

From → Uncategorized

3 Comments Leave one →
  1. Brian Gladman permalink

    Runs in 75 milliseconds in CPython on my Intel I9 ‘Coffee Lake’ laptop.

    • Frits permalink

      @Brian, The order of checks seems to be pretty efficient. I tried to do the is_prime(shaw) and is_prime(pinero) checks as soon as possible but that didn’t make it faster.

  2. Brian Gladman permalink

    @Frits I did try several evaluation orders and this was was far better than the others I tried. In my first (rough) version, I used none of the word relationships other than the common prime and this was very slow on CPython but tolerable on PyPy (~300 milliseconds). Having got to 70 milliseconds on CPython with the version above, I was surprised to find that it was actually slower on PyPy. It will be interesting to see what manual solvers come up with in terms of evaluation order.

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS