please help me, i was stuck in here 2 days!!!(adsbygoogle = window.adsbygoogle || []).push({});

algorithm to prove lcm:

a:=m

b:=n

while a != b

if a < b

a:= a + m

else

b:= b + n

//postcondition: a is the lcm(m,n)

what's the loop invariant?I thought it is(not sure):

lcm(ak, bk) = lcm(ak/m, bk/n) *lcm(m,n)

I am not sure and also impossible to prove my loop invariant....

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Help me about loop invariant of LCM

Loading...

Similar Threads for Help loop invariant | Date |
---|---|

B Help understanding a proof | Jun 8, 2017 |

I Problem understanding the SPAN | May 1, 2017 |

A Linearised N.S.E - advection operator help | Mar 16, 2017 |

I Does this concept have a name? (looping/overlapping time) | Apr 30, 2016 |

**Physics Forums - The Fusion of Science and Community**