Hi
I'm pretty sure there's some built-in function to do the equivalent of
this, but I couldn't find one anywhere:
gp <- function(init, mult, n)
{
if (n == 1)
init
else
pg(c(init, init[length(init)] * mult), mult, n-1)
}
> gp(1, 2, 10)
[1] 1 2 4 8 16 32 64 128 256 512 1024
Any pointers?
Thanks,
Andre
On Sun, 2008-02-24 at 23:26 -0300, Andre Nathan wrote:> > gp(1, 2, 10) > [1] 1 2 4 8 16 32 64 128 256 512 1024 >Actually, [1] 1 2 4 8 16 32 64 128 256 512 Andre
On Feb 24, 2008, at 9:36 PM, Andre Nathan wrote:> On Sun, 2008-02-24 at 23:26 -0300, Andre Nathan wrote: >>> gp(1, 2, 10) >> [1] 1 2 4 8 16 32 64 128 256 512 1024 >> > > Actually, > > [1] 1 2 4 8 16 32 64 128 256 512 >2^(0:9)> > AndreHaris Skiadas Department of Mathematics and Computer Science Hanover College