Ari Brown wrote:
> pascal.rb:29:in `pascal': undefined method `nCr' for 1:Fixnum 
> (NoMethodError)
>         from pascal.rb:24:in `upto'
>         from pascal.rb:24:in `pascal'
>         from pascal.rb:41
> 
> My code:
> class Integer
> 
>   def self.nPr(r)
>     numerator   = factorial(self)
>     denominator = factorial(self - r)
> 
>     @permutations = numerator / denominator
>   end
> end

Ari,

It looks like you are defining--don't remember the ruby term--java calls 
it a static method. You want an instance method. Just declare it as
def self(r)
and not
def self.nPr(r)
because that is called like:
Integer.nPr(something)
and you want:
my_number.nPr(r)

Dan