22 lines
382 B
C#
22 lines
382 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
public class E3 {
|
|
public static List<long> factor(long n) {
|
|
for (long i = 2; i < Math.Sqrt(n); i++) {
|
|
if (n % i == 0) {
|
|
return factor(n/i).Concat(factor(i)).ToList();
|
|
}
|
|
}
|
|
return new List<long> {n};
|
|
}
|
|
|
|
public static void Main() {
|
|
|
|
System.Console.WriteLine(factor(600851475143).Max());
|
|
}
|
|
}
|
|
|
|
|