My wife is reading a book at the moment: “The Curious Incident of the Dog in the Night-Time by Mark Haddon“
Sitting in our sofa, she read out aloud for me from one of the pages, something she knew I would enjoy:
“If you see someone’s name and you give each letter a value from 1 to 26 (a = 1, b = 2 etc.) and you add the numbers up in your head and you find that it makes a prime number, like Jesus Christ…”
Firstly, I don’t have autism or such gifts to compute that in my head right away. Second, I fancy new challenges to tackle using programming.
So I wrote a small script and at the same time learned to write comprehensions in Python, hey! The script asks for on or more names in the Latin alphabet (26 letters in the English alphabet and 29 letters in the Norwegian), converts each character in the name to a number (a=1, b=2..) and check if it is a prime number summed: