当前位置:网站首页>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 .
边栏推荐
- ThinkPHP v3.2 comment annotation injection write shell
- ES6 notes
- Analysis on the problems of irregular step hole on horizontal machining center
- CCF image rotation (Full Score code + problem solving idea) 201503-01
- For loop and promise to solve the problem of concurrent callback
- 1132: stone scissors cloth
- 立式加工中心的数控加工对刀具使用基本要求
- V3 02——What‘s new in Chrome extensions
- Double pointer letter matching
- K high frequency elements before sorting
猜你喜欢

Repair of incorrect deletion of win10 boot entry

Knowledge learned from the water resources institute project

Learn about data kinship JSON format design from sqlflow JSON format
[email protected][])"/>NoViableAltException([email protected][])

LIS error: this configuration section cannot be used in this path

ThinkPHP v3.2 comment annotation injection write shell

CCF date calculation (Full Score code + skill summary) February 2, 2015

DiceCTF - knock-knock

CCF window (Full Score code + problem solving idea) March 2, 2014

CCF sequence segmentation (Full Score code + problem solving idea) 201509 -1
随机推荐
CCF call auction (full mark code + problem solving ideas + skill summary) 201412 - 3
day02
JS array sorting method summary
V3 01_ Welcome
XSS challenge (6-10) more detailed answers
1133: output family and friends string
高精度CNC加工中心为什么会出现误差?这4个原因你要注意!
After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs
Shangpinhui knowledge points of large e-commerce projects
Maximum area of islands searched
Why do high precision CNC machining centers have errors? You should pay attention to these four reasons!
1136: password translation
ThinkPHP show method parameter controllable command execution
Error $(...) size is not a function
Computer screenshot how to cut the mouse in
CCF image rotation (Full Score code + problem solving idea) 201503-01
CCF window (Full Score code + problem solving idea) March 2, 2014
Binary rotation array (2)
DR-TANet: Dynamic Receptive Temporal Attention Network for Street Scene Change Detection
In situ merging of two arrays with two pointers