procedure sigma(n)

   if n = 0 then return 0

   n %:= 9
   
   return if n = 0 then 9 else n

end