#need help abt GCF & LCM

16 messages · Page 1 of 1 (latest)

broken nymph
dreamy fractalBOT
#

need help abt GCF & LCM

past ruin
#

you use python?

#

from math import gcd

def LCM(a, b):
return abs(a*b) // gcd(a, b)

count_pairs = 0

for a in range(1, 100):
for b in range(1, 100):
if gcd(a, 2b) + 2b == LCM(a, b):
count_pairs += 1

print("Number of possible pairs (a, b):", count_pairs)

#

tyr to put this code on python and it might help

#

u have to iterate thru all the possibilities under 100 and then compute right and left to verify if it's equal from both sides if u implement it in python it will do it like understand the problem so it would be easy to write a code for i hope it helped

copper mortar
#

Hint: The right hand side is a multiple of b, so the left hand side must be as well

#

This allows you to set ||a=kb||

broken nymph
#

I got 58

#

Thanks

#

.close

dreamy fractalBOT
#
Solved

Post marked as solved by @broken nymph.

Use .unsolved if this was a mistake.

dreamy fractalBOT
#
Unsolved

Post marked as unsolved by @broken nymph.

Use .solved to mark as solved.

quiet galleon
#

adb -2b

#

b(ad-2)