permutation_combination 0.0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e25b57d6998838672482f44bfbef620601a019a1
4
+ data.tar.gz: bbe1c1e2d2e6ad46b6f964ca73b5c47f4edc4f5a
5
+ SHA512:
6
+ metadata.gz: 58e6b59f9b303eed6136eb3faadd212b0700e2d59419339ab649695e6e1f547cf056a3ff40d31c49f050757ae489884ad0a7ca97fd6541d250e9796be0d15ff7
7
+ data.tar.gz: c29f7813686c7fb634096c098f7f7ccf61d5e8dff5cb3ea492cc1897f959d508519150c652f90723c4ef7759430e95f94096ba0efcf6dc37ce4b642c78f8f34f
@@ -0,0 +1,16 @@
1
+ module PermutationCombination
2
+ class Make
3
+ def factorial(n)
4
+ n.downto(1).inject(:*)
5
+ end
6
+ def permutation_count(n,r)
7
+ factorial(n)/factorial(n-r)
8
+ end
9
+ def combination_count(n,r)
10
+ permutation_count(n,r)/factorial(r)
11
+ end
12
+ end
13
+ end
14
+
15
+ #g = PermutationCombination::Make.new # => #<PermutationCombination::Make:0x007fea1a047318>
16
+ #g.factorial(10) # => 3628800
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module PermutationCombination
2
+ VERSION = '0.0.0'
3
+ end
@@ -0,0 +1,14 @@
1
+ require './lib/version'
2
+
3
+ Gem::Specification.new do |s|
4
+ s.author = 'Mirzalazuardi Hermawan'
5
+ s.email = 'mirzalazuardi@gmail.com'
6
+ s.name = 'permutation_combination'
7
+ s.version = PermutationCombination::VERSION
8
+ s.summary = ''
9
+ s.description = ''
10
+ s.files = `git ls-files`.split("\n")
11
+ s.require_paths = ['lib']
12
+ s.homepage = 'http://rubygems.org/gems/permutation_combination'
13
+ s.license = 'MIT'
14
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: permutation_combination
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Mirzalazuardi Hermawan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: ''
14
+ email: mirzalazuardi@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/permutation_combination.rb
20
+ - lib/version.rb
21
+ - permutation_combination.gemspec
22
+ homepage: http://rubygems.org/gems/permutation_combination
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.5.1
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: ''
46
+ test_files: []