# Scheduling based problem

Can you place these numbers into 5 rows of 4 such that each row totals 20?

1, 2, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 7, 8, 8, 8

Sure.

1,5,6,8
2,4,6,8
3,4,5,8
4,4,5,7
5,5,5,5

Method:

Started from the bigger numbers, and partitioned into 5 parts of 20: {8,8,4}, {8,7,5} and so on.

Then swapped a big number with two smaller ones (with the same sum) on another row until I had 4 numbers on each row.

With some fiddling, it's also possible to get all the columns to add up to 25:

1,8,6,5
5,4,7,4
5,5,5,5
6,4,2,8
8,4,5,3

And here's a magic square (with duplicates, unavoidably) followed by a row of fives:

1,6,8,5
5,7,4,4
8,5,4,3
6,2,4,8
5,5,5,5

And finally:

 4 4 8 4
8 5 4 3
1 5 6 8
7 6 2 5
5 5 5 5  

This has
* 20 on all 5 rows
* 20 on all 4 long diagonals
* 25 in all 4 columns
* a magic square on the first 4 rows

• I'm late ! But I have differents rows :D Apr 25, 2019 at 8:25
• I like the way you went on to challenge yourself by finding solutions to your own proposed questions. Apr 25, 2019 at 9:45
• @5202456 Thanks! The original solution seemed to leave an awful lot of "wiggle room" in the pattern, so I wanted to see what I could do with it. I added one more "extra magical" solution after your comment; hopefully I didn't make any mistakes, as the numbers are starting to bounce around in my eyes :-)
– Bass
Apr 25, 2019 at 11:08

A bit late to the party and cannot beat the excellent answer from @Bass.

I worked out the number of distinct solutions bearing in mind they can be further permuted by ordering each row and the row sequence. I found

16 distinct solutions

I did this by first finding all the sets of four digits which sum to 20.

There are 17 sets of digits

  1  3  8  8
1  4  7  8
1  5  6  8
1  6  6  7
2  3  7  8
2  4  6  8
2  5  5  8
2  5  6  7
3  4  5  8
3  4  6  7
3  5  5  7
3  5  6  6
4  4  4  8
4  4  5  7
4  4  6  6
4  5  5  6
5  5  5  5

I then permuted them for each row so that each digit is used the right number of times.

These are the 16 solutions

 1  3  8  8     1  3  8  8     1  3  8  8     1  3  8  8
2  4  6  8     2  5  5  8     2  5  5  8     2  5  6  7
4  4  5  7     4  4  5  7     4  4  5  7     4  4  4  8
4  5  5  6     4  4  6  6     4  5  5  6     4  5  5  6
5  5  5  5     5  5  5  5     4  5  5  6     5  5  5  5

1  4  7  8     1  4  7  8     1  4  7  8     1  4  7  8
2  4  6  8     2  5  5  8     2  5  5  8     2  5  5  8
3  4  5  8     3  4  5  8     3  4  5  8     3  5  6  6
4  5  5  6     4  4  6  6     4  5  5  6     4  4  4  8
5  5  5  5     5  5  5  5     4  5  5  6     5  5  5  5

1  5  6  8     1  5  6  8     1  5  6  8     1  5  6  8
2  3  7  8     2  4  6  8     2  4  6  8     2  5  5  8
4  4  4  8     3  4  5  8     3  5  5  7     3  4  5  8
4  5  5  6     4  4  5  7     4  4  4  8     4  4  5  7
5  5  5  5     5  5  5  5     5  5  5  5     4  5  5  6

1  5  6  8     1  5  6  8     1  5  6  8     1  6  6  7
2  5  5  8     2  5  5  8     2  5  6  7     2  5  5  8
3  4  6  7     3  5  5  7     3  4  5  8     3  4  5  8
4  4  4  8     4  4  4  8     4  4  4  8     4  4  4  8
5  5  5  5     4  5  5  6     5  5  5  5     5  5  5  5

Method:

A computer program written in C.

• Nice! FYI I generated the puzzle from row 2 column 4.
– JMP
Apr 25, 2019 at 11:28

This one works

7 3 5 5
8 2 5 5
6 4 5 5
8 6 1 5
8 4 4 4

Method :

Write randomly the numbers on a piece of paper during 5 min until the solution appears magically.