RosettaCodeData/Task/Happy-numbers/R/happy-numbers-4.r
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

9 lines
154 B
R

#Find the first 8 happy numbers
happies <- c()
i <- 1L
while(length(happies) < 8L)
{
if(is.happy(i)) happies <- c(happies, i)
i <- i + 1L
}
happies