From 570f58f168dc6966b44b9a6a73ba6c27573843c9 Mon Sep 17 00:00:00 2001 From: David Adi Nugroho Date: Sat, 9 Oct 2021 14:10:38 +0700 Subject: [PATCH] Add project euler p1 and p2 --- DIRECTORY.md | 2 ++ ProjectEuler/Problem1.php | 42 ++++++++++++++++++++++++++++++++++++++ ProjectEuler/Problem2.php | 36 ++++++++++++++++++++++++++++++++ tests/ProjectEulerTest.php | 13 ++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 ProjectEuler/Problem1.php create mode 100644 ProjectEuler/Problem2.php diff --git a/DIRECTORY.md b/DIRECTORY.md index d8e6571..95f4db8 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -19,6 +19,8 @@ * [Perfectsquare](https://github.com/TheAlgorithms/PHP/blob/master/Maths/PerfectSquare.php) ## Projecteuler + * [Problem1](https://github.com/TheAlgorithms/PHP/blob/master/ProjectEuler/Problem1.php) + * [Problem2](https://github.com/TheAlgorithms/PHP/blob/master/ProjectEuler/Problem2.php) * [Problem5](https://github.com/TheAlgorithms/PHP/blob/master/ProjectEuler/Problem5.php) * [Problem7](https://github.com/TheAlgorithms/PHP/blob/master/ProjectEuler/Problem7.php) * [Problem9](https://github.com/TheAlgorithms/PHP/blob/master/ProjectEuler/Problem9.php) diff --git a/ProjectEuler/Problem1.php b/ProjectEuler/Problem1.php new file mode 100644 index 0000000..edb920e --- /dev/null +++ b/ProjectEuler/Problem1.php @@ -0,0 +1,42 @@ +assertSame(233168, problem1a()); + $this->assertSame(233168, problem1b()); + } + + public function testProblem2(): void + { + $this->assertSame(4613732, problem2()); + } + public function testProblem5(): void { $this->assertSame(232792560, problem5());