static void dupe() { Int64 div3 = (1000 + 3 - 1) / 3; //VERY IMPORTANT. HOW TO ROUND UP Int64 div5 = (1000 + 5 - 1) / 5; Int64[] arr1 = new Int64[div3]; Int64[] arr2 = new Int64[div5]; Int64[] arr3 = new Int64[Math.Abs(arr1.Length + arr2.Length) / 2]; fillarr3(arr1); fillarr5(arr2); //int[] a3 = new int[arr1.Length + arr2.Length]; //arr1.CopyTo(a3, 0); //arr2.CopyTo(a3, arr1.Length); //var result = arr1.Union(arr2).ToArray(); //result = arr1.Concat(arr2).OrderBy(v =>Math.Abs(v)).ToArray(); var result = arr1.Concat(arr2).Distinct().OrderBy(v => Math.Abs(v)).ToArray(); Int64 sum = result.Sum(); Console.WriteLine(sum); foreach (int i in result) { Console.WriteLine(i); } Console.WriteLine(sum - 1); }