RosettaCodeData/Task/Happy-numbers/R/happy-numbers-4.r
2023-07-01 13:44:08 -04: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