nthprime
n번째 소수
설명
예제
N번째 소수 구하기
223번째 소수를 구합니다.
nthprime(223)
ans = 1409
큰 소수의 경우 기호 입력값을 사용하여 정확한 기호 정수를 반환합니다.
n = sym(223222222); nthprime(n)
ans = 4738278383
10번째, 100번째, 1000번째 소수를 구합니다.
n = [10 100 1000]; nthprime(n)
ans = 29 541 7919
무작위 소수 생성하기
100,000번째 소수와 200,000번째 소수 사이의 무작위 소수를 생성합니다.
rng default % for reproducibility range = [100000 200000]; nthprime(randi(range))
ans = 2476423
입력 인수
n
— 입력값
숫자 | 벡터 | 행렬 | 배열 | 기호 숫자 | 기호 배열
입력값으로, 숫자, 벡터, 행렬, 배열로 지정되거나 기호 숫자 또는 기호 배열로 지정됩니다. n
은 양의 정수여야 합니다.
버전 내역
R2018a에 개발됨
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)