← RoseCode

ROSECODE 163

Consecutive numbers

sinan · Programming ·

For N>0, consider the ways to write N as the sum of consecutive integers from a to b where b>=a>0.
N=a+(a+1)+(a+2)+...+(b-1)+b For example: N=9=4+5=2+3+4 N=10=1+2+3+4 Let N be the product of first 42 primes: N=prod(i=1,42,prime(i)) N=5397346292805549782720214077673687806275517530364350655459511599582614290 How can we write N in such a way that (b-a) is maximized? Input format: a,b Example: 1,20 for the product of first 4 primes: N=2*3*5*7=210=1+2+3+...+20