Advertisement
Guest User

Untitled

a guest
Aug 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. public class RemovedNumbers {
  7. public static List<long[]> removNb(long n) {
  8. List<long[]> result = new List<long[]>();
  9. long sum = n * (n + 1) / 2;
  10. for (int j = 1; j <= n; j++) {
  11. long a = (sum - j) / (j + 1);
  12. if (a * j + a + j == sum && a < n) {
  13. result.Add(new long[] { j, a });
  14. }
  15. }
  16. return result;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement