Wednesday, July 12, 2017

summation - How to find the consecutive odd numbers that sum to a given odd number

Given a non perfect square odd number, say $1649$ What is the most efficient way to find the consecutive odd positive integers that sum to that number.



No other information is provided, just the odd number to solve.



In reality the odd numbers I want to find are substantially larger than 1649 which would be trivial to find the consecutive odds that sum to it. So I am looking for an efficient generalised method to turn into an algorithm to resolve this problem for any given odd number.



EDIT:
Perhaps I should have added. The numbers I am working with are too large to factor in an efficient manner. Therefore the difference of two squares is not a workable option.




I am looking for alternate approaches to solving the problem.

No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...