Skip to content

Commit eff182b

Browse files
authored
Merge pull request #2 from SpecterOps/2024-q2-updates
chore: minor improvements
2 parents 91a63d4 + 30e9881 commit eff182b

5 files changed

Lines changed: 31 additions & 10 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
.vscode
2+
.idea
13
.DS_Store
24

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22

33
## The Sieve of Eratosthenes
44

5-
Prime numbers have many modern day applications and a long history in mathematics. Utilizing your own resources research the sieve of Eratosthenes, an algorithm for generating prime numbers. Based on your research, implement an API that allows the caller to retrieve the Nth prime number.
6-
Some stub code and a test suite have been provided as a convenience, however, you are encouraged to deviate from Eratosthenes's algorithm, modify the existing functions/methods or anything else that might showcase your ability provided the following requirements are satisfied.
7-
Stub code has been provided in Go, C#, and Javascript. Please use the language that is most appropriate based on your own skillset
5+
Prime numbers have many modern day applications and a long history in
6+
mathematics. Utilizing your own resources research the sieve of Eratosthenes,
7+
an algorithm for generating prime numbers. Based on your research, implement
8+
an API that allows the caller to retrieve the Nth prime number.
9+
Some stub code and a test suite have been provided as a convenience, however,
10+
you are encouraged to deviate from Eratosthenes's algorithm, modify the
11+
existing functions/methods or anything else that might showcase your ability
12+
provided the following requirements are satisfied.
13+
14+
You must author your work in either Go, JavaScript/TypeScript, or C# - all
15+
other language submissions will be rejected. Stub code has been provided so
16+
please choose from one of the provided language stubs that is most
17+
appropriate based on your own skill set and the position you are applying for.
818

919
### Requirements
1020

@@ -19,6 +29,9 @@ Stub code has been provided in Go, C#, and Javascript. Please use the language t
1929

2030
### Considerations
2131

32+
You may add more tests or restructure tests, but you may NOT change or remove
33+
the existing test outcomes; eg- f(0)=2, f(19)=71, f(99)=541, ..., f(10000000)=179424691
34+
2235
During the technical interview, your submission will be discussed, and you will be evaluated in the following areas:
2336

2437
- Technical ability

csharp/Sieve.Tests/UnitTest1.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public void TestNthPrime()
1515
Assert.AreEqual(7793, sieve.NthPrime(986));
1616
Assert.AreEqual(17393, sieve.NthPrime(2000));
1717
Assert.AreEqual(15485867, sieve.NthPrime(1000000));
18+
Assert.AreEqual(179424691, sieve.NthPrime(10000000));
19+
//Assert.AreEqual(2038074751, sieve.NthPrime(100000000));
1820
}
1921
}
2022
}

go/pkg/sieve/sieve_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import (
1010
func TestNthPrime(t *testing.T) {
1111
sieve := NewSieve()
1212

13-
assert.Equal(t, 2, sieve.NthPrime(0))
14-
assert.Equal(t, 71, sieve.NthPrime(19))
15-
assert.Equal(t, 541, sieve.NthPrime(99))
16-
assert.Equal(t, 3581, sieve.NthPrime(500))
17-
assert.Equal(t, 7793, sieve.NthPrime(986))
18-
assert.Equal(t, 17393, sieve.NthPrime(2000))
19-
assert.Equal(t, 15485867, sieve.NthPrime(1000000))
13+
assert.Equal(t, int64(2), sieve.NthPrime(0))
14+
assert.Equal(t, int64(71), sieve.NthPrime(19))
15+
assert.Equal(t, int64(541), sieve.NthPrime(99))
16+
assert.Equal(t, int64(3581), sieve.NthPrime(500))
17+
assert.Equal(t, int64(7793), sieve.NthPrime(986))
18+
assert.Equal(t, int64(17393), sieve.NthPrime(2000))
19+
assert.Equal(t, int64(15485867), sieve.NthPrime(1000000))
20+
assert.Equal(t, int64(179424691), sieve.NthPrime(10000000))
21+
//assert.Equal(t, int64(2038074751), sieve.NthPrime(100000000))
2022
}
2123

2224
func FuzzNthPrime(f *testing.F) {

javascript/Sieve/sieve.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ describe("Sieve", () => {
1010
expect(sieve.NthPrime(986)).toBe(7793);
1111
expect(sieve.NthPrime(2000)).toBe(17393);
1212
expect(sieve.NthPrime(1000000)).toBe(15485867);
13+
expect(sieve.NthPrime(10000000)).toBe(179424691);
14+
//expect(sieve.NthPrime(100000000)).toBe(2038074751);
1315
});
1416
});

0 commit comments

Comments
 (0)