N-argument least common multiple calculator with arbitrary precision

버전 1.5.0.0 (985 Bytes) 작성자: Shawn Divitt
This function returns the least common multiple of the set of integers passed to it.
다운로드 수: 168
업데이트 날짜: 2014/11/4

라이선스 보기

This function returns the least common multiple of the set of integers passed to it. The number of inputs can be very large. The function outputs the exact lcm integer. For instance, lcm(1,2,...,1000) is approximately 7.12e432 and vlcm will give all 433 digits. This function is an improvement over the function referenced below in that it uses the "vpa" routine built into MATLAB in order to give arbitrary precision.
usage: output = vlcm(M);
Here, M is the vector of integers for which the lcm is to be calculated.
In the first example we will calculate lcm(1,2,...,100):
>>vlcm(1:100)
ans =
69720375229712477164533808935312303556800
To get the number to 10 significant digits in scientific notation use vpa:
>> vpa(ans,10)
ans =
6.972037523e40
For another example we will calculate lcm(1,2,...,10000). This is impossible using the function referenced below. The number has 4349 digits so we will use scientific notation for brevity. We have:
>> vpa(vlcm(1:10000),10)
ans =
5.79333967e4348

The image is of the second Chebyshev function, which is given by log10(lcm(1,...,n)) and was calculated using this function

인용 양식

Shawn Divitt (2025). N-argument least common multiple calculator with arbitrary precision (https://kr.mathworks.com/matlabcentral/fileexchange/48312-n-argument-least-common-multiple-calculator-with-arbitrary-precision), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2012b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Number Theory에 대해 자세히 알아보기
태그 태그 추가

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.5.0.0

Fixed the title.

1.4.0.0

Added a better and more descriptive image.

1.3.0.0

Replaced the uint8 with uint32 in order to increase the number of allowable digits in the answer.

1.2.0.0

fixed an issue with small integers

1.1.0.0

added the requirement of the symbolic toolbox

1.0.0.0