Sign in Join
Wiki copytemporary

Least common multiple/ru

English · Français · Suomi · Русский

Наименьшим общим кратным (НОК) двух целых чисел $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.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.