Dear Janesh,

Here is one way:

# note "x" is a character
x <-
"73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557"

k <- nchar(x)  # digits in x
b <- 5  # period
tapply(strsplit(x, "")[[1]], rep(1:(nchar(x)/b), each = b), function(x)
prod(as.numeric(x)))

HTH,
Jorge.-



On Thu, Apr 18, 2013 at 6:47 PM, Janesh Devkota <janesh.devkota@gmail.com>wrote:

> Hello,
>
> I have a big number lets say of around hundred digits. I want to subset
> that big number into consecutive number of 5 digits and find the product of
> those 5 digits. For example my first 5 digit number would be 73167. I need
> to check the product of the individual numbers in 73167 and so on.
>
> The sample number is as follows:
>
>
>
> 73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557
>
> I have a problem subsetting the small numbers out of the big number.
>
> Any help is highly appreciated.
>
> Best Regards,
> Janesh Devkota
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

