Tarango

Solution Hints: Light OJ 1278 - Sum of Consecutive Integers

Sep 1st, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.22 KB | None | 0 0
  1.  
  2.  SOLUTION HINTS For Light OJ 1278 - Sum of Consecutive Integers:
  3.  
  4.  THE MEANING OF THE QUESTIONS: Given n, n can be written in
  5.  the form of at least two consecutive positive integers and the
  6.  number of species.
  7.  
  8.  IDEAS: Let n can be written as a, a +1, a +2 ...... a + k-1's and (a> = 1),
  9.  i.e., n = (a + a + k-1) * k / 2.
  10.  If k is odd, then, N = (A + (k-1) / 2) * k.
  11.  If k is even, then (a + a + k-1) is an odd number.
  12.  
  13.  So if there are a set of solutions, must correspond to an odd prime.
  14.  
  15.  THE FOLLOWING PROVED, a odd prime number other than 1, each odd prime number corresponds to a solution.
  16.  Let x n is an odd prime number, so that y = n / x. Then the relationship between x and y, only the following two:
  17.  
  18.  (1) y> (x-1) / 2, In this case, n must be able to be written as n = (a + (k-1) / 2) * k of the form.
  19.      Wherein x = K, y = a - a + (k-1) / 2, this time to meet a = y-(K-1) / 2 = y-(x-1) / 2 is a positive integer;
  20.  (2) y <= (x-1) / 2, where n must be able to be written as n = n = (a + a + k-1) * k / 2 of the form.
  21.      Wherein, y = k / 2, x = a + A + k-1.
  22.      
  23. This time A = (x +1- k) / 2 = (x +1- y * 2) / 2 = (x-1) / 2-y +1> = 1.
  24.  THEREFORE, an odd prime number must correspond to a solution.
Advertisement
Add Comment
Please, Sign In to add comment