numb 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/numb/sophie_germain_prime.rb +5 -0
- data/lib/numb.rb +3 -2
- data/spec/sophie_germain_prime_spec.rb +15 -0
- metadata +5 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
data/lib/numb.rb
CHANGED
@@ -6,8 +6,9 @@ libs = %w{abundant achilles automorphic carol composite deficient
|
|
6
6
|
impolite kaprekar keith kynea lucas lucas_carmichael mms_pair mobius
|
7
7
|
narcissistic nivenmorphic ordinal parasitic perfect perfect_power
|
8
8
|
polite polydivisible powerful practical pronic self self_descriptive
|
9
|
-
semi_perfect semiprime smarandache_wellin smith
|
10
|
-
square_free triangular trimorphic undulating vampire
|
9
|
+
semi_perfect semiprime smarandache_wellin smith sophie_germain_prime
|
10
|
+
sphenic square square_free triangular trimorphic undulating vampire
|
11
|
+
weird
|
11
12
|
}
|
12
13
|
|
13
14
|
class Integer
|
@@ -0,0 +1,15 @@
|
|
1
|
+
describe Integer, "#sophie_germain_prime?" do
|
2
|
+
SGP = [2,3,5,11,23,29,41,53,83,89,113,131,173,179,191,
|
3
|
+
233,239,251,281,293,359,419,431,443,491,509,593,
|
4
|
+
641,653,659,683,719,743,761,809,911,953,1013,1019,
|
5
|
+
1031,1049,1103,1223,1229,1289,1409,1439,1451,1481,
|
6
|
+
1499,1511,1559]
|
7
|
+
|
8
|
+
it "returns true for Sophie Germain primes" do
|
9
|
+
SGP.each{|n| n.should be_sophie_germain_prime}
|
10
|
+
end
|
11
|
+
|
12
|
+
it "returns false for non-Sophie Germain primes" do
|
13
|
+
([*1..SGP.max] - SGP).each{|n| n.should_not be_sophie_germain_prime}
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: numb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Run Paint Run Run
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-03 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/numb/semiprime.rb
|
86
86
|
- lib/numb/smarandache_wellin.rb
|
87
87
|
- lib/numb/smith.rb
|
88
|
+
- lib/numb/sophie_germain_prime.rb
|
88
89
|
- lib/numb/sphenic.rb
|
89
90
|
- lib/numb/square.rb
|
90
91
|
- lib/numb/square_free.rb
|
@@ -140,6 +141,7 @@ files:
|
|
140
141
|
- spec/semiprime_spec.rb
|
141
142
|
- spec/smarandache_wellin_spec.rb
|
142
143
|
- spec/smith_spec.rb
|
144
|
+
- spec/sophie_germain_prime_spec.rb
|
143
145
|
- spec/spec_helper.rb
|
144
146
|
- spec/sphenic_spec.rb
|
145
147
|
- spec/square_free_spec.rb
|
@@ -205,6 +207,7 @@ test_files:
|
|
205
207
|
- spec/lucas_carmichael_spec.rb
|
206
208
|
- spec/composite_spec.rb
|
207
209
|
- spec/practical_spec.rb
|
210
|
+
- spec/sophie_germain_prime_spec.rb
|
208
211
|
- spec/parasitic_spec.rb
|
209
212
|
- spec/number_of_prime_factors_spec.rb
|
210
213
|
- spec/frugal_spec.rb
|