From 9874daa1c1f1685c194e143f709086d55597999d Mon Sep 17 00:00:00 2001 From: narkunan Date: Tue, 28 Apr 2026 19:26:29 +0530 Subject: [PATCH 1/5] Updated instructions for nth-prime --- exercises/practice/nth-prime/.docs/instructions.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/exercises/practice/nth-prime/.docs/instructions.md b/exercises/practice/nth-prime/.docs/instructions.md index 30a75216..065e323a 100644 --- a/exercises/practice/nth-prime/.docs/instructions.md +++ b/exercises/practice/nth-prime/.docs/instructions.md @@ -2,8 +2,6 @@ Given a number n, determine what the nth prime is. -By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that -the 6th prime is 13. +By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. -If your language provides methods in the standard library to deal with prime -numbers, pretend they don't exist and implement them yourself. +If your language provides methods in the standard library to deal with prime numbers, pretend they don't exist and implement them yourself. From 142442fad5f67961aab3dc3ab293dce329898ad9 Mon Sep 17 00:00:00 2001 From: narkunan Date: Tue, 28 Apr 2026 19:26:49 +0530 Subject: [PATCH 2/5] Added nth-prime in auto-sync.txt --- bin/auto-sync.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/auto-sync.txt b/bin/auto-sync.txt index bf8742fe..72dbe849 100644 --- a/bin/auto-sync.txt +++ b/bin/auto-sync.txt @@ -49,6 +49,7 @@ markdown matching-brackets matrix meetup +nth-prime micro-blog nucleotide-count ocr-numbers From 4677eb30cda9ea367ba7220aa00623564425d32c Mon Sep 17 00:00:00 2001 From: narkunan Date: Tue, 28 Apr 2026 19:28:57 +0530 Subject: [PATCH 3/5] Removed Strict comments from Test and example file --- .../practice/nth-prime/.meta/example.php | 22 ----------- exercises/practice/nth-prime/NthPrimeTest.php | 37 ++++++++----------- 2 files changed, 15 insertions(+), 44 deletions(-) diff --git a/exercises/practice/nth-prime/.meta/example.php b/exercises/practice/nth-prime/.meta/example.php index 17d2c8fc..5b31af6f 100644 --- a/exercises/practice/nth-prime/.meta/example.php +++ b/exercises/practice/nth-prime/.meta/example.php @@ -1,27 +1,5 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); function prime($count) diff --git a/exercises/practice/nth-prime/NthPrimeTest.php b/exercises/practice/nth-prime/NthPrimeTest.php index c9f1f9f4..950e656b 100644 --- a/exercises/practice/nth-prime/NthPrimeTest.php +++ b/exercises/practice/nth-prime/NthPrimeTest.php @@ -1,29 +1,8 @@ . - * - * To disable strict typing, comment out the directive below. - */ - declare(strict_types=1); +use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; class NthPrimeTest extends TestCase @@ -33,22 +12,36 @@ public static function setUpBeforeClass(): void require_once 'NthPrime.php'; } + /** uuid: 75c65189-8aef-471a-81de-0a90c728160c */ + #[TestDox('first prime')] public function testFirstPrime(): void { $this->assertEquals(2, prime(1)); } + + /** uuid: 2c38804c-295f-4701-b728-56dea34fd1a0 */ + #[TestDox('second prime')] public function testSecondPrime(): void { $this->assertEquals(3, prime(2)); } + + /** uuid: 56692534-781e-4e8c-b1f9-3e82c1640259 */ + #[TestDox('sixth prime')] public function testSixthPrime(): void { $this->assertEquals(13, prime(6)); } + + /** uuid: fce1e979-0edb-412d-93aa-2c744e8f50ff */ + #[TestDox('big prime')] public function testBigPrime(): void { $this->assertEquals(104743, prime(10001)); } + + /** uuid: bd0a9eae-6df7-485b-a144-80e13c7d55b2 */ + #[TestDox('there is no zeroth prime')] public function testZeroPrime(): void { $this->assertEquals(false, prime(0)); From d41c9dcaed7a5de0c537b598d98ee4914cdcdd86 Mon Sep 17 00:00:00 2001 From: narkunan Date: Tue, 28 Apr 2026 19:29:08 +0530 Subject: [PATCH 4/5] Added contributor name --- exercises/practice/nth-prime/.meta/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/practice/nth-prime/.meta/config.json b/exercises/practice/nth-prime/.meta/config.json index 0b44d248..0ae4fb01 100644 --- a/exercises/practice/nth-prime/.meta/config.json +++ b/exercises/practice/nth-prime/.meta/config.json @@ -7,7 +7,8 @@ "kunicmarko20", "kytrinyx", "petemcfarlane", - "yisraeldov" + "yisraeldov", + "Narkunan" ], "files": { "solution": [ From d6205c48582d9bd87b3507b790d4487518f72a28 Mon Sep 17 00:00:00 2001 From: narkunan Date: Wed, 29 Apr 2026 12:36:15 +0530 Subject: [PATCH 5/5] Updated Nth prime test and updated example code to throw exception --- exercises/practice/nth-prime/.meta/example.php | 2 +- exercises/practice/nth-prime/NthPrimeTest.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/exercises/practice/nth-prime/.meta/example.php b/exercises/practice/nth-prime/.meta/example.php index 5b31af6f..3d3508e7 100644 --- a/exercises/practice/nth-prime/.meta/example.php +++ b/exercises/practice/nth-prime/.meta/example.php @@ -5,7 +5,7 @@ function prime($count) { if ($count < 1) { - return false; + throw new Exception('there is no zeroth prime'); } $primes = []; $i = 2; diff --git a/exercises/practice/nth-prime/NthPrimeTest.php b/exercises/practice/nth-prime/NthPrimeTest.php index 950e656b..b318e325 100644 --- a/exercises/practice/nth-prime/NthPrimeTest.php +++ b/exercises/practice/nth-prime/NthPrimeTest.php @@ -44,6 +44,8 @@ public function testBigPrime(): void #[TestDox('there is no zeroth prime')] public function testZeroPrime(): void { - $this->assertEquals(false, prime(0)); + $this->expectException(Exception::class); + $this->expectExceptionMessage('there is no zeroth prime'); + prime(0); } }