DEV Community

loading...

Discussion on: Daily Challenge #214 - Persistent Bugger

Collapse
windeep profile image
windeep

Ruby

def persistence(n)
    cnt = 0
    loop do 
    return cnt  if  n < 10 
    n = n.digits.reduce(&:*)
    cnt +=1      
    end
end