Problem 2595. Polite numbers. Politeness.
A polite number is an integer that sums of two or more consecutive positive integers. Politeness of a positive integer is a number of nontrivial ways to write n as a sum of two or more consecutive positive integers.
For example 9 = 4+5 = 2+3+4 and politeness of 9 is 2.
Given N return politeness of N.
See also 2593
Solution Stats
Problem Comments
-
5 Comments
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.
Solution Comments
Show commentsProblem Recent Solvers175
Suggested Problems
-
Create a cell array out of a struct
2082 Solvers
-
Celsius to Fahrenheit converter
628 Solvers
-
15549 Solvers
-
Find last zero for each column
591 Solvers
-
Check that number is whole number
4557 Solvers
More from this Author40
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!