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

Home > Numbers
Getting closer to three targets (Posted on 2012-07-01) Difficulty: 4 of 5
STEP1 : Arrange 10 distinct digits and 2 blank spaces into 3x4 matrix.

Example:
12sp8
4567
3sp09


STEP2 : Now sum up the numbers row by row (in our example SumRows=12+8+4567+3+9=4599).

STEP3 : Next sum up the numbers column by column (in our example SumCols=143+25+60+879=1107).

STEP4 : Evaluate the ratio R= (bigger sum)/ (smaller sum). In our example 4599/1107=4.14543

You are requested to arrange the 12 symbols so that the value of R will be as close as possible to:
a) 1.000
b) 2.000
c) Phi (the golden ratio =1.618034)

No Solution Yet Submitted by Ady TZIDON    
Rating: 5.0000 (1 votes)

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

QB64 enabled this to run in under 1/2 hour:

DECLARE FUNCTION total# (x$)
DEFDBL A-Z
DECLARE SUB permute (a$)
OPEN "closer3.txt" FOR OUTPUT AS #2
CLS
a$ = "0123456789  ": h$ = a$
best1diff = .01: best2diff = .01: bestphidiff = .01
phi = (1 + SQR(5)) / 2
DO
    b$ = MID$(a$, 1, 1) + MID$(a$, 5, 1) + MID$(a$, 9, 1) + " "
    b$ = b$ + MID$(a$, 2, 1) + MID$(a$, 6, 1) + MID$(a$, 10, 1) + " "
    b$ = b$ + MID$(a$, 3, 1) + MID$(a$, 7, 1) + MID$(a$, 11, 1) + " "
    b$ = b$ + MID$(a$, 4, 1) + MID$(a$, 8, 1) + MID$(a$, 12, 1) + " "
    a2$ = MID$(a$, 1, 4) + " " + MID$(a$, 5, 4) + " " + MID$(a$, 9, 4) + " "

    tot1 = total(a2$)
    tot2 = total(b$)
    rat = tot1 / tot2: IF rat < 1 THEN rat = 1 / rat
    diff1 = ABS(1 - rat): diff2 = ABS(2 - rat): diffphi = ABS(phi - rat)

    IF diff1 <= best1diff OR diff2 <= best2diff OR diffphi <= bestphidiff THEN
        IF diff1 < best1diff THEN best1diff = diff1: PRINT rat, diff1
        IF diff2 < best2diff THEN best2diff = diff2: PRINT rat, diff2
        IF diffphi < bestphidiff THEN bestphidiff = diffphi: PRINT rat, diffphi
        PRINT #2, a$; "; "; rat
    END IF
    prv$ = MID$(a$, 1, 1)
    permute a$
    IF MID$(a$, 1, 1) <> prv$ THEN PRINT a$
LOOP UNTIL a$ = h$
CLOSE 2

DEFDBL A-Z
FUNCTION total (x$)
x2$ = x$
t = 0
DO
    ix = INSTR(x2$, " ")
    t = t + VAL(MID$(x2$, 1, ix - 1))
    x2$ = LTRIM$(MID$(x2$, ix))
LOOP UNTIL x2$ = ""
total = t
END FUNCTION

Out of the 12!/2 (= 239,500,800) permutations of the digits and spaces, there are many, many ways of getting exactly 1 or 2 (149,516 and 208,600 ways, respectively), such as

For 1:
134 
9 87
0526
 278
4 69
1350
70 9
3 42
1586
For 2:
1 69
 350
2784
 278
4 69
3051
859 
024
3671


The 116 ways of getting 1.618025751072961, the closest possible to phi (~= 1.618033988749895) are:

1857
 602
 934
2397
 586
 410
2397
 856
 140
2479
 053
 861
2497
 035
 861
2586
 397
 410
2586
 793
 014
2793
 586
 014
2856
 397
 140
2965
 341
 087
3279
5 68
0 41
3279
5 68
1 40
3279
8 65
0 41
3279
8 65
1 40
3297
5 86
1 04
3297
5 86
4 01
3297
6 85
1 04
3297
6 85
4 01
397 
586
2410
397 
856
2140
4 97
3205
1 86
4 97
3205
6 81
479 
053
2861
479 
2061
853
479 
2063
851
497 
035
2861
497 
2061
835
497 
2065
831
497 
2510
386
497 
2516
380
5 68
3279
0 41
5 68
3279
1 40
5 69
0 71
3248
5 69
1 70
3248
5 69
3241
0 78
5 69
3241
8 70
5 78
3214
0 96
5 78
3214
6 90
5 78
3241
0 69
5 78
3241
9 60
5 86
3297
1 04
5 86
3297
4 01
5 96
1 07
3284
5 96
3214
0 78
5 96
3214
8 70
5 96
7 01
3284
586 
397
2410
586 
793
2014
6 59
3241
0 87
6 59
3241
7 80
6 85
3297
1 04
6 85
3297
4 01
6 95
1 07
3284
6 95
3214
0 78
6 95
3214
8 70
6 95
7 01
3284
65 9
70 1
3248
65 9
71 0
3248
69 5
70 1
3248
69 5
71 0
3248
7 49
3250
1 86
7 49
3250
6 81
7 94
3205
1 86
7 94
3205
6 81
749 
2061
583
749 
2063
581
793 
586
2014
794 
2061
538
794 
2068
531
794 
2513
086
794 
2516
083
8 65
3279
0 41
8 65
3279
1 40
8 75
3214
0 96
8 75
3214
6 90
8 75
3241
0 69
8 75
3241
9 60
856 
397
2140
857 
602
1934
9 47
3250
1 86
9 47
3250
6 81
9 56
3241
0 87
9 56
3241
7 80
9 65
0 71
3248
9 65
1 70
3248
9 65
3241
0 78
9 65
3241
8 70
947 
2061
385
947 
2065
381
95 6
01 7
3284
95 6
07 1
3284
96 5
01 7
3284
96 5
07 1
3284
965 
341
2087
974 
2061
358
974 
2068
351
 397
 586
2410
 397
 856
2140
 397
2586
 410
 397
2856
 140
 479
 053
2861
 479
2053
 861
 497
 035
2861
 497
2035
 861
 586
 397
2410
 586
 793
2014
 586
2397
 410
 586
2793
 014
 793
 586
2014
 793
2586
 014
 856
 397
2140
 856
2397
 140
 857
 602
1934
 857
1602
 934
 965
 341
2087
 965
2341
 087

 


  Posted by Charlie on 2012-07-01 18:36:12
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 (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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