Skip to main content
edited body
Source Link
bigyihsuan
  • 10.8k
  • 1
  • 23
  • 66

Go, 7675 bytes

func f(n int)int{if n<10{return n}
k:=0
for;n>0;n/=10{k+=n%10}
return f(k)
 }

Attempt This Online!Attempt This Online!

Go, Modulus solution, 29 bytes

func(n int)int{return^-n%9+1}
func(n int)int{return^-n%9+1}

Attempt This Online!

Go, 76 bytes

func f(n int)int{if n<10{return n}
k:=0
for;n>0;n/=10{k+=n%10}
return f(k)
 }

Attempt This Online!

Go, Modulus solution, 29 bytes

func(n int)int{return^-n%9+1}

Attempt This Online!

Go, 75 bytes

func f(n int)int{if n<10{return n}
k:=0
for;n>0;n/=10{k+=n%10}
return f(k)}

Attempt This Online!

Go, Modulus solution, 29 bytes

func(n int)int{return^-n%9+1}

Attempt This Online!

Source Link
bigyihsuan
  • 10.8k
  • 1
  • 23
  • 66

Go, 76 bytes

func f(n int)int{if n<10{return n}
k:=0
for;n>0;n/=10{k+=n%10}
return f(k)
}

Attempt This Online!

Go, Modulus solution, 29 bytes

func(n int)int{return^-n%9+1}

Attempt This Online!