![]() |
A small puzzle
Here's a no doubt not-terribly-difficult problem, but it's not exactly trivial. I have little interest in actually solving it, so here it is for the forum's
enjoyment: Given a target n and a count c, how many different ways are there for `c` integers to sum to `n`? For instance, with n=11 and c=4, the total is eleven: [code](1, 1, 1, 8) (1, 1, 2, 7) (1, 1, 3, 6) (1, 1, 4, 5) (1, 2, 2, 6) (1, 2, 3, 5) (1, 2, 4, 4) (1, 3, 3, 4) (2, 2, 2, 5) (2, 2, 3, 4) (2, 3, 3, 3)[/code] |
[url]https://en.wikipedia.org/wiki/Partition_%28number_theory%29#Restricted_part_size_or_number_of_parts[/url]
|
[QUOTE=axn;417474][url]https://en.wikipedia.org/wiki/Partition_%28number_theory%29#Restricted_part_size_or_number_of_parts[/url][/QUOTE]
Ah. Well I wasn't wrong :smile: (rather, my google queries into the matter were ignorant of the extant terminology) |
[QUOTE=Dubslow;417472]Given a target n and a count c, how many different ways are there for `c` integers to sum to `n`?
For instance, with n=11 and c=4, the total is eleven: [code](1, 1, 1, 8) (1, 1, 2, 7) (1, 1, 3, 6) (1, 1, 4, 5) (1, 2, 2, 6) (1, 2, 3, 5) (1, 2, 4, 4) (1, 3, 3, 4) (2, 2, 2, 5) (2, 2, 3, 4) (2, 3, 3, 3)[/code][/QUOTE]The puzzle as stated has an infinite number of solutions. So your puzzle in return it is discover why it has in infinite number of solutions. |
[QUOTE=retina;417493]The puzzle as stated has an infinite number of solutions.
So your puzzle in return it is discover why it has in infinite number of solutions.[/QUOTE] Do you perhaps refer to my lack of specifying strictly positive integers? |
[QUOTE=Dubslow;417494]Do you perhaps refer to my lack of specifying strictly positive integers?[/QUOTE]
Your original post did not specify that. BTW there is a term specifically for them "natural numbers". |
[deleted]
sorry, ignore this, I didn't read to the end |
[QUOTE=LaurV;417504][deleted]
sorry, ignore this, I didn't read to the end[/QUOTE] oops, me too, started to jump in too soon. typical. :smile: |
[QUOTE=Uncwilly;417497]Your original post did not specify that. BTW there is a term specifically for them "natural numbers".[/QUOTE]
The naturals are 1,2,3,..., and don't usually include 0. The axiomatic approach begins with 0 and a successor rule. By starting with 0, instead of 1, it's easier to define the arithmetic operations. |
[QUOTE=davar55;417507]The naturals are 1,2,3,..., and don't usually include 0.[/QUOTE]The way that I was taught "natural numbers" and "whole numbers" were differentiated by 0 being in one and not the other. Trying to reconfirm before posting led to some confusion. The way I recall:
[[[[[whole]natural]integers]rational]+[irrational]]=[real] [imaginary] |
[QUOTE=Dubslow;417472]but it's not exactly trivial. [/QUOTE]
[CODE]partitions(n,,[c,c])[/CODE] in PARI would work |
| All times are UTC. The time now is 05:34. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.