I've recently stumbled upon a Russian site called acmp.ru, in which one of the tasks, HOK, asks us to find the LCM of two positive integers. The full statement, translated to English is as follows:
The only line of the input contains two natural numbers A and B separated by a space, not exceeding 46340.
In the only line of the output, you need to output one integer - the LCM of the numbers A and B.
On the Python leaderboard, the top solution is just 50 bytes, followed by a stream of 52s.
Note that the scoring method for this site is not standard, and uses the following formula:
max(code length without spaces, tabs and newlines, full code length divided by 4)
With this in mind, I have come up with two solutions that give a score of 52. One of them simply uses
math.lcm, while the other one calculates it more directly:
from math import* print(lcm(*map(int,input().split())))
a,b=map(int,input().split()) v=a while v%b:v+=a print(v)
Now I'm stumped. How can I save 2 bytes off my solution? (the Python version is 3.9.5).
gcd(a,b)==B**(a*b)//~-B**a%~-B**b%Bsome a large enough value