I am trying to convert a number into array of (1s, 2s, 4s) so that their sum is equal to the number
NUMBER = 12
length 1: 12 = 12
length 2: 6+6 = 12
length 3: 4+4+4 = 12
length 4: 2+2+4+4 = 12
length 5: 2+2+2+2+4 = 12
length 6: 2+2+2+2+2+2 = 12
...
...
length 12: 1+1+1+1+1+1+1+1+1+1+1+1 = 12
Aucun commentaire:
Enregistrer un commentaire