Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- public class RemovedNumbers {
- public static List<long[]> removNb(long n) {
- List<long[]> result = new List<long[]>();
- long sum = n * (n + 1) / 2;
- for (int j = 1; j <= n; j++) {
- long a = (sum - j) / (j + 1);
- if (a * j + a + j == sum && a < n) {
- result.Add(new long[] { j, a });
- }
- }
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement