From New Scientist #649, 15th May 1969 [link]
The fruit machine in our club devours sixpences, which it occasionally returns as follows:
5s for the Jackpot
2s for any two members of the Jackpot in their correct positions, the third being missing
1s for the right hand member of the Jackpot setting, the other two being missing.
Niggardly, you may think. But you would make 3s profit on these six tries:

and 2s on these six tries:

What is the Jackpot setting?
Note: 1s (shilling) = 2 sixpences.
A version of this puzzle is also included in the book Tantalizers (1970).
[tantalizer99]
(See also: Puzzle #135).
Each try costs a sixpence, so to play 6 tries costs 3s. So the first group must win 6s to make a 3s profit, and the second group must win 5s to make a 2s profit.
This Python program tries each possible jackpot setting to find one where the groups make the required winnings.
It runs in 74ms. (Internal runtime is 409µs).
from enigma import (subsets, join, printf) # return win for result <rs> against jackpot <js> def win(rs, js): # count the correct positions k = sum(x == y for (x, y) in zip(rs, js)) # jackpot wins 5 if k == 3: return 5 # 2 correct wins 2 if k == 2: return 2 # just RH correct wins 1 if rs[2] == js[2]: return 1 # lose return 0 # tries and winnings tries = [ ("LPP LCL PLC PCL CLP CPC".split(), 6), ("LLP PPL PPC PCP CLC CPP".split(), 5), ] # choose a jackpot setting (allow an "other" symbol) for js in subsets("CLP?", size=3, select='M'): # check the tries win the required amount if all(sum(win(rs, js) for rs in ts) == w for (ts, w) in tries): # output solution printf("jackpot = {js}", js=join(js))Solution: The jackpot is:
(i.e. it is the first given try).
For the first set of 6 tries the winnings are: 5 + 0 + 0 + 0 + 1 + 0 = 6.
For the second set of 6 tries the winnings are: 2 + 0 + 0 + 1 + 0 + 2 = 5.