Post Reply 
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 Smile
Code:
1  2  3  4  5  6  7  8  9
=========================
   4     2  5  8     6
   8     6  5  4     2

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
20 FOR I1=1 TO 4 @ D(1)=O(I1)
30 FOR I2=1 TO 2 @ D(2)=4*I2 @ D(6)=12-D(2)
40 FOR I3=1 TO 4 @ D(3)=O(I3)
50 IF I3=I1 OR MOD(D(1)+D(2)+D(3),3) THEN 140
60 D(4)=2+4*(D(2)=8) @ D(8)=8-D(4)
70 FOR I4=1 TO 4 @ D(7)=O(I4)
80 IF I4=I1 OR I4=I3 THEN 130
90 X=0 @ FOR J=1 TO 7 @ X=10*X+D(J) @ NEXT J
100 IF MOD(X,7) OR MOD(10*X+D(8),8) THEN 130
110 X=100*X+10*D(8)+9 @ X=X-MOD(X,9) @ DISP X
130 NEXT I4
140 NEXT I3
150 NEXT I2
160 NEXT I1

>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
=========================
   4     2  5  8  9  6
   8     6  5  4  3  2
   8     6  5  4  7  2

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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Puzzle - RPL and others - Gene - 04-22-2021, 06:55 PM
RE: Puzzle - RPL and others - rprosperi - 04-23-2021, 04:21 PM
RE: Puzzle - RPL and others - EdS2 - 04-23-2021, 07:30 AM
RE: Puzzle - RPL and others - Dave Britten - 04-23-2021, 12:06 PM
RE: Puzzle - RPL and others - 3298 - 04-23-2021, 09:17 AM
RE: Puzzle - RPL and others - ijabbott - 04-23-2021, 03:57 PM
RE: Puzzle - RPL and others - Albert Chan - 04-23-2021 04:08 PM
RE: Puzzle - RPL and others - Albert Chan - 04-27-2021, 12:14 PM
RE: Puzzle - RPL and others - 3298 - 04-23-2021, 09:05 PM
RE: Puzzle - RPL and others - C.Ret - 04-24-2021, 04:40 PM
RE: Puzzle - RPL and others - C.Ret - 04-25-2021, 09:25 AM
RE: Puzzle - RPL and others - Claudio L. - 04-26-2021, 04:56 PM
RE: Puzzle - RPL and others - 3298 - 04-27-2021, 08:16 PM
RE: Puzzle - RPL and others - Albert Chan - 04-28-2021, 02:33 AM
RE: Puzzle - RPL and others - Albert Chan - 04-28-2021, 03:30 AM
RE: Puzzle - RPL and others - 3298 - 04-28-2021, 10:14 PM
RE: Puzzle - RPL and others - Albert Chan - 04-29-2021, 03:25 AM
RE: Puzzle - RPL and others - Allen - 04-28-2021, 08:45 PM
RE: Puzzle - RPL and others - Albert Chan - 04-29-2021, 05:16 PM
RE: Puzzle - RPL and others - Allen - 04-29-2021, 07:03 PM
RE: Puzzle - RPL and others - C.Ret - 05-02-2021, 06:40 AM
RE: Puzzle - RPL and others - 3298 - 05-03-2021, 03:43 PM
RE: Puzzle - RPL and others - Albert Chan - 05-04-2021, 03:29 AM
RE: Puzzle - RPL and others - 3298 - 05-04-2021, 06:48 AM
RE: Puzzle - RPL and others - Albert Chan - 05-05-2021, 06:29 PM
RE: Puzzle - RPL and others - 3298 - 05-06-2021, 04:24 PM
RE: Puzzle - RPL and others - Albert Chan - 05-06-2021, 09:09 PM
RE: Puzzle - RPL and others - Albert Chan - 05-07-2021, 10:35 AM
RE: Puzzle - RPL and others - 3298 - 05-07-2021, 04:17 PM
RE: Puzzle - RPL and others - Albert Chan - 05-09-2021, 01:21 AM
RE: Puzzle - RPL and others - 3298 - 05-09-2021, 01:39 PM
RE: Puzzle - RPL and others - Albert Chan - 05-10-2021, 03:57 AM
RE: Puzzle - RPL and others - Albert Chan - 05-07-2021, 02:56 AM
RE: Puzzle - RPL and others - Albert Chan - 05-10-2021, 05:13 PM
RE: Puzzle - RPL and others - 3298 - 05-10-2021, 08:23 PM
RE: Puzzle - RPL and others - Albert Chan - 05-11-2021, 11:58 AM
RE: Puzzle - RPL and others - 3298 - 05-11-2021, 02:14 PM
RE: Puzzle - RPL and others - John Keith - 05-11-2021, 03:55 PM
RE: Puzzle - RPL and others - ijabbott - 05-11-2021, 10:37 PM
RE: Puzzle - RPL and others - Albert Chan - 05-13-2021, 11:38 PM



User(s) browsing this thread: 1 Guest(s)