问题2595.礼貌的数字。礼貌。
解决方案Stats
Problem Comments
-
5 Comments
There are some flaws when checking the solutions:
I think 15 has 4 combinations of sum of consecutive INTEGERS (as stated in the problem):
15 = 7+8 = 4+5+6 = 1+2+3+3+4+5 = 0+1+2+2+3+4+5;%0是整数。
或1025(您说5,我说9):
1025 = 1022+1023 = sum(203:207) = sum(98:107) = sum(29:53) = sum(5:45) = sum(-4:45) = sum(-28:53) = sum(-97:107) = sum(-202:207); % negative numbers are integers too.
I can see the flaw in the description now, I've missed repeating "positive", Thanks. Btw considering your interpretation 15 has 7 combinations: sum(-14:15),sum(-6:8),sum(-3:6),sum(0:5),sum(1:5),sum(4:6),sum(7:8). In this way 1025 should have 11 and conversion between our interpretations is "yours=2*mine+1"; to any of mine solutions of the form m:n, you can add "-m+1:n", the last thing is to add "-input+1:input"
An interesting problem, enough so that I chose to solve it in three essentially different ways. As always, there are various ways to solve any problem. The first two ways were essentially constructive, so counting the set of solutions for any N. The last used a formulaic approach.
Politeness is an integer sequence defined at https://oeis.org/A069283.
@Dyuman Joshi: I do not know why that error occurs. I do know that it essentially means that the user needs to wait and re-submit their solution at a later time, sometimes the next day.
By the way, it's best to not post solutions (or solution attempts) in comments. Questions or comments specific to a solution can be posted in a comment tied to said solution or solution attempt.
解决方案Comments
-
1 Comment
why it is showing--"While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service'' ...
-
1 Comment
So, doing a little reading about polite numbers, one finds that the politeness divisors is related to the number of odd divisors.
-
1 Comment
矢量化和建设性,明确计算所有解决方案的均匀和奇数k万博 尤文图斯
-
1 Comment
蛮力,有一段时间的循环。原本是地狱,但它适用于第一次过去。
-
1 Comment
Whit this solution you can check the correct number of combinations that summing consecutive integers give the input number.
-
2 Comments
Problem Recent Solvers130
建议的问题
1336 Solvers
1775 Solvers
2562 Solvers
275个求解器
Magic is simple (for beginners)
5225求解器
来自作者的更多40
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
开始狩猎!