c# e3
This commit is contained in:
parent
7bf2f073d7
commit
967163b950
|
@ -0,0 +1,21 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue