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

Home > Numbers
Continued Multiples (Posted on 2013-11-29) Difficulty: 3 of 5
(1)Take a 2-digit number and multiply the two digits together. Repeat with each product until a single digit is the result. For most starting numbers, no more than three of these steps are needed to arrive at the final single digit. (For example: 57: 5*7=35: 3*5=15: 1*5=5). Find one that takes four steps.

(2)Start with a 3-digit number. Choose any one of the digits and remove it to make a 2-digit number. Multiply the 2-digit number by the digit you removed. Eventually, you will get a 2-digit number, which will yield a single digit, as above. What number should you start with, and what steps should you take to find the longest series of steps you can take to arrive at that final single digit

No Solution Yet Submitted by Danish Ahmed Khan    
Rating: 3.5000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 3 |

DECLARE SUB cntnu ()
CLEAR , , 25000
CLS
FOR n = 10 TO 99
 p = n: PRINT p;
 WHILE p > 9
  m1 = p 10: m2 = p MOD 10
  p = m1 * m2
  PRINT p;
 WEND
 PRINT
 IF n = 54 THEN DO: LOOP UNTIL INKEY$ > "": PRINT
NEXT
DO: LOOP UNTIL INKEY$ > "": PRINT

DIM SHARED h(50), ct, max, hmax(50), hw(50) AS STRING
FOR n = 100 TO 999
  h(1) = n
  ct = 1
  cntnu
NEXT

SUB cntnu
 p = h(ct)
 d1 = p 100: d2 = (p 10) MOD 10: d3 = p MOD 10

 p = d1 * (10 * d2 + d3): ct = ct + 1: h(ct) = p: hw(ct) = "h"
 IF p < 10 AND d1 > 0 THEN
  GOSUB checkmax
 ELSE
  IF p > 0 THEN cntnu
 END IF
 ct = ct - 1

 p = d2 * (10 * d1 + d3): ct = ct + 1: h(ct) = p: hw(ct) = "t"
 IF p < 10 AND (d1 > 0 OR d2 > 0) THEN
  GOSUB checkmax
 ELSE
  IF p > 0 THEN cntnu
 END IF
 ct = ct - 1

 p = d3 * (10 * d1 + d2): ct = ct + 1: h(ct) = p: hw(ct) = "u"
 IF p < 10 AND (d1 > 0 OR d2 > 0) THEN
  GOSUB checkmax
 ELSE
  IF p > 0 THEN cntnu
 END IF
 ct = ct - 1

 EXIT SUB

checkmax:
  IF ct >= max THEN
    match = 1
    FOR i = 1 TO ct
      IF h(i) <> hmax(i) THEN match = 0: EXIT FOR
    NEXT
    IF ct > max THEN match = 0
    IF match = 0 THEN
      FOR i = 1 TO ct
        IF i > 1 THEN PRINT hw(i);
        PRINT h(i);
        hmax(i) = h(i)
      NEXT
      PRINT
    END IF
    max = ct
  END IF

RETURN

END SUB

 

finds for part 1:

10  0
11  1
12  2
13  3
14  4
15  5
16  6
17  7
18  8
19  9
20  0
21  2
22  4
23  6
24  8
25  10  0
26  12  2
27  14  4
28  16  6
29  18  8
30  0
31  3
32  6
33  9
34  12  2
35  15  5
36  18  8
37  21  2
38  24  8
39  27  14  4
40  0
41  4
42  8
43  12  2
44  16  6
45  20  0
46  24  8
47  28  16  6
48  32  6
49  36  18  8
50  0
51  5
52  10  0
53  15  5
54  20  0
55  25  10  0
56  30  0
57  35  15  5
58  40  0
59  45  20  0
60  0
61  6
62  12  2
63  18  8
64  24  8
65  30  0
66  36  18  8
67  42  8
68  48  32  6
69  54  20  0
70  0
71  7
72  14  4
73  21  2
74  28  16  6
75  35  15  5
76  42  8
77  49  36  18  8
78  56  30  0
79  63  18  8
80  0
81  8
82  16  6
83  24  8
84  32  6
85  40  0
86  48  32  6
87  56  30  0
88  64  24  8
89  72  14  4
90  0
91  9
92  18  8
93  27  14  4
94  36  18  8
95  45  20  0
96  54  20  0
97  63  18  8
98  72  14  4
99  81  8

so 77, 49, 36, 18, 8 is the sequence sought by part 1.

The longest sequence found for part 2 has 10 steps:

878 u 696 t 594 t 486 t 368 u 288 t 224 u 88 t 64 t 24 t 8
887 h 696 t 594 t 486 t 368 u 288 t 224 u 88 t 64 t 24 t 8
898 h 784 t 592 t 468 u 368 u 288 t 224 u 88 t 64 t 24 t 8
988 t 784 t 592 t 468 u 368 u 288 t 224 u 88 t 64 t 24 t 8
999 h 891 h 728 u 576 t 392 h 276 t 182 t 96 t 54 t 20 t 0
999 h 891 h 728 u 576 t 392 t 288 t 224 u 88 t 64 t 24 t 8
999 t 891 h 728 u 576 t 392 h 276 t 182 t 96 t 54 t 20 t 0
999 t 891 h 728 u 576 t 392 t 288 t 224 u 88 t 64 t 24 t 8
999 u 891 h 728 u 576 t 392 h 276 t 182 t 96 t 54 t 20 t 0
999 u 891 h 728 u 576 t 392 t 288 t 224 u 88 t 64 t 24 t 8

where the h, t or u specifies whether the hundreds, tens or units position was the one pulled out as the separate multiplier. A sequence is shown only if it has one or more numbers different from another of the sequences, so that, for example, when starting with 887 it did not matter whether you started with removal of the hundreds or the tens position. With 2-digit number of course it never matters.

Added note:

I see the two sequences for 999 were multiplied by 3 as the check for duplicates was only on consecutive solutions of the same maximum length, and since there were two real solutions, they separated the sequences that were duplicates.

Edited on November 29, 2013, 5:23 pm
  Posted by Charlie on 2013-11-29 17:18:15

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 (23)
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