Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 8 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Python 3, 70(削除) 70 (削除ここまで) 69 bytes

import math
f=lambda n,d=10d=1:n>d and n%d*~-math.gcd(n//d,n%d)+f(n,10*d)

Try it online! Try it online!

Python 3, 70 bytes

import math
f=lambda n,d=10:n>d and n%d*~-math.gcd(n//d,n%d)+f(n,10*d)

Try it online!

Python 3, (削除) 70 (削除ここまで) 69 bytes

import math
f=lambda n,d=1:n>d and n%d*~-math.gcd(n//d,n%d)+f(n,10*d)

Try it online!

Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Python 3, 70 bytes

import math
f=lambda n,d=10:n>d and n%d*~-math.gcd(n//d,n%d)+f(n,10*d)

Try it online!

AltStyle によって変換されたページ (->オリジナル) /