Sunday Times Teaser 3348 – Remembering my PIN
by Howard Williams
Published Sunday November 22 2026 (link)
With fraud scams on the increase I’m concerned about losing my bank card or having it stolen and somebody gaining access to my four-digit PIN. For this reason I don’t write my PIN down anywhere, but how can I remember it?
By chance I’ve found that the PIN that I have is a perfect square. Also, I can check it before use, as when I divide it by seven of the eight numbers between two and nine there is a remainder of one. I can’t reveal my PIN’s last digit as you should then be able to work it out.
What is my PIN?
3 Comments
Leave one →
-
John Z permalink123456789101112131415161718# four digit pinssq = tuple(n * n for n in range(32, 100))# candidate pins meeting remainder = 1 criterioncpins = tuple(p for p in sq if sum(p % d == 1 for d in range(2, 10)) == 7)sols = [[] for n in range(10)]# organise pins by last digitfor p in cpins:sols[p % 10].append(p)# find pin with unique last digitfor sol in sols:if len(sol) == 1:print('Pin :', *sol)
-
GeoffR permalink1234567891011121314151617181920from collections import defaultdictdgts = defaultdict(list)for n in range(32, 100):# count number of divisors between two and nine#... that there is a remainder of one.cnt = 0N = n ** 2for d in range(2, 10):if N % d == 1:cnt += 1if cnt == 7:# index dictionary on last pin digitdgts[N % 10] += [N]for k, v in dgts.items():if len(v) == 1:print(f"PIN = {v[0]}")