Skip to main content
Commonmark migration
Source Link

#R, 38 37 bytes

R, 38 37 bytes

f=function(x)if(x>1)1+f(log(x))else 0

Thanks @user5957401 for the extra byte!

Test cases:

> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4

#R, 38 37 bytes

f=function(x)if(x>1)1+f(log(x))else 0

Thanks @user5957401 for the extra byte!

Test cases:

> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4

R, 38 37 bytes

f=function(x)if(x>1)1+f(log(x))else 0

Thanks @user5957401 for the extra byte!

Test cases:

> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#R, 38 37 bytes

f=function(x)if(x>1)1+f(log(x))else 0

Thanks @user5957401@user5957401 for the extra byte!

Test cases:

> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4

#R, 38 37 bytes

f=function(x)if(x>1)1+f(log(x))else 0

Thanks @user5957401 for the extra byte!

Test cases:

> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4

#R, 38 37 bytes

f=function(x)if(x>1)1+f(log(x))else 0

Thanks @user5957401 for the extra byte!

Test cases:

> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4
added 101 characters in body
Source Link
plannapus
  • 9k
  • 22
  • 47

#R, 3838 37 bytes

f=function(x)ifelseif(x>1,)1+f(log(x)),else 0)

Thanks @user5957401 for the extra byte!

Test cases:

> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4

#R, 38 bytes

f=function(x)ifelse(x>1,1+f(log(x)),0)

Test cases:

> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4

#R, 38 37 bytes

f=function(x)if(x>1)1+f(log(x))else 0

Thanks @user5957401 for the extra byte!

Test cases:

> f(0)
[1] 0
> f(1)
[1] 0
> f(2)
[1] 1
> f(3)
[1] 2
> f(4)
[1] 2
> f(3814279)
[1] 3
> f(3814280)
[1] 4
Source Link
plannapus
  • 9k
  • 22
  • 47
Loading