Posts Tagged ‘ prime number ’

Prime Number in R Language (CloudStat)

November 28, 2011
By
Prime Number in R Language (CloudStat)

A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. R Language Code The Prime Function prime = function(n){   n = as.integer(n)   if(n > 1e8) stop(“n too large”)   primes = re...

Read more »

Le Monde puzzle [#29]

July 28, 2011
By
Le Monde puzzle [#29]

This week, the puzzle from the weekend edition of Le Monde was easy to state: in the sequence (8+17n), is there a 6th power? a 7th? an 8th? If so, give the first occurrence. So I first wrote an R code for a function testing whether an integer is any power: (The function returns the

Read more »