Let's start with a triplet of integers, say (1, 2, 5) and a set of mathematical operations (+, -, *, /, ^, sqrt, fact!, concatenation, brackets).
Our task will be to represent all (or almost all - as explained below) integers from 1 to n using some or all of the initial triplet and any quantity of operations defined above.
So:
1=1
6=1+5
9=5*2-1
13=15-2
27=51-4!
60=12*5 etc
Let's define n as the first occurrence of not being able to find a valid representation for n+1 and for n+2. I believe that in our case n=17 (15+2), since neither 18 nor 19 get valid solutions.
You are requested to find a triplet of integers (a,b,c) enabling a maximal n.
With 4, 7 and 9 we can get up to 77, where we encounter 78 and 79 as impossible.
For some reason my program didn't allow for single-digit formulae, so 4 was given as sqrt(7+9), 7 as sqrt(49) and 9 as sqrt(4)+7.
Some other bugs were fixed, but I haven't run a full comparison of all positive combinations. But here's the repaired set for the top combination of the first run:
n RPN Algebraic
1 4,9v- 4-sqrt(9)
2 4v sqrt(4)
3 9v sqrt(9)
4 7,9+v sqrt((7+9))
5 9,4- 9-4
6 9v! (sqrt(9))!
7 49v sqrt(49)
8 4,9v^v sqrt(4^sqrt(9))
9 4v,7+ sqrt(4)+7
10 7,9v+ 7+sqrt(9)
11 4,7+ 4+7
12 4,9v* 4*sqrt(9)
13 4,9+ 4+9
14 4v,7* sqrt(4)*7
15 4!,9- (4)!-9
16 7,9+ 7+9
17 4!,7- (4)!-7
18 4v,9* sqrt(4)*9
19 4,7*,9- 4*7-9
20 4,7+,9+ 4+7+9
21 7,9v* 7*sqrt(9)
22 4!,7+,9- (4)!+7-9
23 4v,7*,9+ sqrt(4)*7+9
24 4! (4)!
25 4,7*,9v- 4*7-sqrt(9)
26 4!,7-,9+ (4)!-7+9
27 4!,9v+ (4)!+sqrt(9)
28 4,7* 4*7
29 4,9*,7- 4*9-7
30 4!,9v!+ (4)!+(sqrt(9))!
31 4!,7+ (4)!+7
32 4v,7,9+* sqrt(4)*(7+9)
33 4!,9+ (4)!+9
34 4,7*,9v!+ 4*7+(sqrt(9))!
35 7,9,4-* 7*(9-4)
36 4,9* 4*9
37 4,7*,9+ 4*7+9
38 47,9- 47-9
39 7,9*,4!- 7*9-(4)!
40 4,7,9v+* 4*(7+sqrt(9))
41 47,9v!- 47-(sqrt(9))!
42 49,7- 49-7
43 4,9*,7+ 4*9+7
44 47,9v- 47-sqrt(9)
45 7,4v-,9* (7-sqrt(4))*9
46 4,7,9v!*+ 4+7*(sqrt(9))!
47 47 47
48 4!,9,7-* 4!*(9-7)
49 49 49
50 47,9v+ sqrt(9)
51 4!,7-,9v* ((4)!-7)*sqrt(9)
52 4,7,9v!+* 4*(7+(sqrt(9))!)
53 47,9v!+ 47+(sqrt(9))!
54 7,4-!,9* ((7-4))!*9
55 79,4!- 79-(4)!
56 47,9+ 47+9
57 4,9v^,7- 4^sqrt(9)-7
58 7,4^v,9+ sqrt(7^4)+9
59 7,9*,4- 7*9-4
60 7,4v-,9v!!*v sqrt(((7-sqrt(4))*((sqrt(9))!)!))
61 7,9*,4v- 7*9-sqrt(4)
62
63 7,9* 7*9
64 4,9v^ 4^sqrt(9)
65 74,9- 74-9
66 4,7+,9v!* (4+7)*(sqrt(9))!
67 4,7,9*+ 4+7*9
68 74,9v!- 74-(sqrt(9))!
69
70 4,9v!+,7* (4+(sqrt(9))!)*7
71 74,9v- 74-sqrt(9)
72 4!,9v* (4)!*sqrt(9)
73 97,4!- 97-(4)!
74 74 74
75 79,4- 79-4
76 4,9!,7!/+ 4+(9)!/(7)!
77 74,9v+ 74+sqrt(9)
78
79 79 79
80 74,9v!+ (sqrt(9))!
81 9,4^v sqrt(9^4)
82
83 4,79+ 4+79
84 4,7*,9v* 4*7*sqrt(9)
I also tried using zero as a member of the triplet, but for some reason also, my algorithm didn't try using it even for adding 1 via 0!. But at least I think I've got the maximal result without any triplet containing zero.
Most of this program has been used in other such puzzles, and an outer loop was added, to go through all combinations of three positive digits, and not to try more exotic things like double factorial.
|
Posted by Charlie
on 2020-09-10 14:25:40 |