All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Ambiguous PIN Code (Posted on 2010-11-17) Difficulty: 3 of 5
Susan couldn't quite remember her bank PIN code.

She knew:

  • It had 4 or 5 digits.
  • It used 4 or 5 different digits.
  • The first digit is 4 or 5.
  • The second digit is 4 or 5 and none of the other digits is smaller.
  • The number is 4 or 5 times a prime number.
  • If you reverse the order of the digits, the resulting number has 4 or 5 prime factors, all different.
  • In 4 or 5 of these facts, the "4" is the correct number.

What is Susan's PIN code?

  Submitted by Charlie    
Rating: 2.5000 (2 votes)
Solution: (Hide)
list
   10   for N=4444 to 55999
   20    Ns=cutspc(str(N))
   22    Num1=5-len(Ns)
   30    Good=1:Rct=0
   40    for I=1 to len(Ns)-1
   50        if instr(mid(Ns,I+1,*),mid(Ns,I,1))>0 then Rct=Rct+1
   60    next
   70    if Rct>1 or Rct=1 and len(Ns)=4 or left(Ns,1)<"4" then Good=0
   72    if len(Ns)=4 or Rct=1 then Num1=Num1+1
   73    if left(Ns,1)="4" then Num1=Num1+1
   74    if mid(Ns,2,1)="4" then Num1=Num1+1
   80    if Good=0 then goto *Notthis
   90    if mid(Ns,2,1)<>"4" and mid(Ns,2,1)<>"5" then Good=0
   95    if mid(Ns,1,1)<mid(Ns,2,1) then Good=0
  100    if mid(Ns,3,1)<mid(Ns,2,1) then Good=0
  110    if mid(Ns,4,1)<mid(Ns,2,1) then Good=0
  120    if len(Ns)=5 then if mid(Ns,5,1)<mid(Ns,2,1) then Good=0
  130    Ok1=0
  140    if N @ 4=0 then if prmdiv(N//4)=N//4 then Ok1=1:Num1=Num1+1
  150    if N @ 5=0 then if prmdiv(N//5)=N//5 then Ok1=1
  160    if Good=1 then Good=Ok1
  170    N2=0
  180    for I=len(Ns) to 1 step -1
  190       N2=N2*10+val(mid(Ns,I,1))
  200    next
  210    Pct=0:Prevd=0
  220    while N2>1
  230        D=prmdiv(N2):N2=N2//D:if Prevd=D then Good=0
  240        Pct=Pct+1:Prevd=D
  250    wend
  260    if Pct<4 or Pct>5 then Good=0
  261   if Pct=4 then Num1=Num1+1
  280    if Good then print N,Num1
  299   *Notthis
  300   next N
OK
run
 5468    5
 54476   4
OK

shows that, of the two numbers that satisfy all the items, 5468 uses the 4 in 5 of the first 6 items and 54476 uses the 4 in 4. If the latter were the answer, then the 4 in the 7th clue would be correct and make the total 5, but then it would revert to 4, etc. ad infinitum, being a paradox, so that can't be the answer.

The answer is thus 5468, and the 4 is correct in 5 of the clues, leading to no paradox in the final clue.

From Enigma No. 1609, "I remember it well", by Susan Denham, New Scientist, 21 August 2010, page 26.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Puzzle AnswerK Sengupta2022-05-29 23:19:00
Good problem!broll2010-11-20 03:30:02
re(3): A Pin that worksJer2010-11-19 16:22:05
re: Possible solutionJer2010-11-19 16:13:10
re(2): A Pin that worksCharlie2010-11-19 12:01:02
re: A Pin that worksbroll2010-11-18 17:08:44
A Pin that worksJer2010-11-18 15:55:00
re: Possible solution -- don't consider this closed yetCharlie2010-11-17 16:30:25
Possible solutionbroll2010-11-17 11:34:53
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (21)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information