Sign in Join
Wiki copytemporary

Revision 1 of 1, by Useroflazarus on 2-13-2018. The page as it is now.

Least common multiple/ru

Наименьшим общим кратным (НОК) двух целых чисел $a$ и $b$ является наименьшее положительное целое число, которое делится на оба числа $a$ и $b$.

Например: для чисел 12 и 9 наименьшим общим кратным будет число 36.

Функция leastCommonMultiple

pascal
function leastCommonMultiple(a, b: Int64): Int64;
begin
  result := b * (a div greatestCommonDivisor(a, b));
end;

Note: Функция greatestCommonDivisor должна быть объявлена перед функцией leastCommonMultiple.

См. также


From the Free Pascal wiki, page "Least common multiple/ru", as it stood on 2018-02-13 after a change by Useroflazarus, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.