+ 9
[challenge] Decompose into terms
You have a number. Your task: write a program which decompose this number into terms. Example. Input: 4 Output: 1+1+1+1 1+1+2 1+3 4
12 Réponses
+ 12
Here's oneliner :
https://code.sololearn.com/cIIHqOIe46K4/?ref=app
+ 13
https://code.sololearn.com/cE4t6IVQpnPs/?ref=app
+ 4
a python answer to the challenge
https://code.sololearn.com/c8yeq86r4Git/?ref=app
+ 4
https://code.sololearn.com/ch3wG3exDxvc/?ref=app
+ 3
Challenge accepted
+ 3
Gives the number of decompositions without calculating them
https://code.sololearn.com/cn11qTHKtT8N/?ref=app
+ 2
How many ones?
+ 2
for 4 what about 2+2 ? if the challenge is to write i + n-i time 1 this is not a really good one
print("\n".join("1"*i+str(n-i)*(i<n) for i in range(n+1))
0
Here is a solution including all solutions including 4=2+2
https://code.sololearn.com/cN0n8eiMAkK9/?ref=app
0
My solution in Python
https://code.sololearn.com/ctg4naAJT8v2/#py