当前位置:网站首页>Matlab finds a prime number that is greater than a given integer and follows this integer
Matlab finds a prime number that is greater than a given integer and follows this integer
2022-06-30 14:53:00 【Tongxuan Shangjing programmer】
Problem description : Find an integer greater than the given value ( Greater than required 30) And then the prime of this integer , And output as program value .
Go straight to the code :
clc;clear;
n=input(' Please enter n:');
for i=n+1:1e+4
for j=2:i
if(rem(i,j)==0&&i~=j)
break;
elseif(j==i)
fprintf(" Followed by Prime %d\n",i);
return ;// It's the following , Not all !
end
end
endBe careful :return It can't be less , Or you can try .
边栏推荐
- Basic learning notes of C language
- Shift operator (detailed)
- NoViableAltException([email protected][])
- Searching for single element in dichotomy
- Summary of FTP network protocol learning
- Clear the route cache in Vue
- Text matching - [naacl 2021] augsbert
- Upgrade centos7 mysql5.5 to mysql5.7 non RPM in the form of tar package
- Greedy two-dimensional array sorting
- CCF command line options (Full Score code + problem solving ideas + skill summary) March 3, 2014
猜你喜欢
随机推荐
CCF sequence segmentation (Full Score code + problem solving idea) 201509 -1
Maximum area of islands searched
Upgrade composer self update
MV3 04_ Introducing Manifest V3
Shift operator (detailed)
Binary rotation array (1)
Programming exercises: special numbers (problem solving ideas + code implementation)
Effect of shadow around the block after mouse over
Is it troublesome for CITIC futures to open an account? Is it safe? How much is the handling charge for opening an account for futures? Can you offer a discount
Clear the route cache in Vue
机械工程师面试的几个问题,你能答上来几个?
For loop and promise to solve the problem of concurrent callback
2021-08-05 leetcode notes
左旋梯形螺纹的编程
Searching for single element in dichotomy
Solution cannot use a scalar value as an array
[extensive reading of papers] a delicious recipe analysis framework for exploring multi modal recipes with variable attributes
[buuctf] [geek challenge 2019] secret file
val_ Loss decreases first and then increases or does not decrease but only increases
V3_ Chrome extended Chinese translation document V3 directory





![【BUUCTF】[GXYCTF2019]Ping Ping Ping1](/img/dc/4d87dfb0c2fa9cd75b54e092fd3971.jpg)



