Puzzle - RPL and others
|
04-23-2021, 04:08 PM
(This post was last modified: 04-27-2021 11:24 AM by Albert Chan.)
Post: #7
|
|||
|
|||
RE: Puzzle - RPL and others
Let most significant digit = first digit (digit 1)
Even digits must be even Odd digits must be odd 5th digit = 5. 4th digit + 8th digit must be 2 or 6 (Divisible by 4 only if last 2 digits divisible by 4. Example, 14 won't do it) This filled all even numbers Code: 1 2 3 4 5 6 7 8 9 This is perhaps optimized enough to start coding ... Brute force for 4! = 24 cases, done in Emu71/DOS Code: 10 DIM O(4),D(8) @ D(5)=5 @ O(1)=1 @ O(2)=3 @ O(3)=7 @ O(4)=9 >RUN 381654729 --- We can solve the puzzle, all by hand (without calculator !) Digits(123) divisible by 3. If 2nd digit is 4, top digits must have 1 somewhere (because 4%3=1) Digits(678) divisisble by 8 → 7th digit cannot be 1. Code: 1 2 3 4 5 6 7 8 9 If Digits(1 to 3) divisible by 3, Digits(1 to 7) divisible by 7, we are done. Note: 9th digit does not matter. If top 8 is correct, we found the solution. Modulo 7, we have 10≡3, 100≡3*3≡2, 1000≡3*2≡-1 We "remove" 7th digit, and do 2 groups of 3-digits, to test mod 7: 1/10 ≡ 100/1000 ≡ 2/-1 ≡ -2 (mod 7) 258-2*9 ≡ 254 ≡ 2, top 3 digits must be 2 (mod 7) 147 ≡ 0, 741 ≡ 6, all failed 654-2*3 ≡ 654+1 ≡ 4, top 3 digits must be 4 (mod 7) 789 ≡ 5, 987 ≡ 0, 189 ≡ 0, 981 ≡ 1, all failed 654-2*7 ≡ 654 ≡ 3, top 3 digits must be 3 (mod 7) 183 ≡ 1, 381 ≡ 3, 189 ≡ 0, 981 ≡ 1, 1 solution. Answer (proven unique): soc sec# 381-65-4729 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)