Euler 1-5
This commit is contained in:
parent
9cf858b860
commit
68a75987e2
6 changed files with 161 additions and 0 deletions
16
project_euler/problem3.cc
Normal file
16
project_euler/problem3.cc
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include <cstdint>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "sieve.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
std::uint64_t input = 600'851'475'143;
|
||||
auto sieve = std::make_unique<Sieve<1'000'000>>();
|
||||
|
||||
for (auto value = static_cast<std::uint64_t>(std::sqrt(input)); value--; )
|
||||
{
|
||||
if (sieve->is_prime(value) && input % value == 0)
|
||||
fmt::print("Result: {}\n", value);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue