If you use my answer, please remember to "measure twice, cut once"; that is, check this on paper before cutting...
Since 56" / 4" = 14, you may need only 14 lines of lumber (provided that the planks are a true 4").
Also, I am assuming that there is no loss when you make a cut (or the loss will be covered by quarter rounds at the ends).
You could have lines (in any order)
19-19-19 17-17-23 13-19-25 16-17-24
17-18-22 17-11-29 19-16-22 12-12-33
17-14-26 7-19-31 17-20-20
18-10-19 17-5-35 14-24-19
Need 8 boards cut 19-17 1 cut 18-18 2 cut 22 -14 1 cut 26-10
1 cut 23-13 1 cut 25-11 1 cut 29-7 1 cut 31-5
1 cut 35-1 2 cut 20-16 2 cut 24-12 1 cut 33-3
No wasted boards, only 4" not used.
I don't know of any mathematical formula; try these (before cutting)!