返回最小素数p <100,000的MATLAB函数,使得(p + n)为素数,其中n是标量整数,是唯一的输入

时间:2015-08-27 14:15:17

标签: matlab

我有这个MATLAB诅咒的作业。我14岁,我无法完全理解这个问题,因为我的英语技能。我想帮助解决这个问题。提前谢谢你。

function pr=prime(n)

1 个答案:

答案 0 :(得分:6)

如果这是作业,我不会给你结果,但只是一些关于如何到达那里的想法。

您需要一个函数 static void SetInterface(string interfaceName, bool enable) { string type; if (enable == true) type = "enable"; else type = "disable"; System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("netsh", String.Format("interface set interface {0} {1}", interfaceName, type)); System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo = psi; p.Start(); } ,它将返回您刚才描述的内容。

示例输出:findmyprime() findmyprime(2)因为第一个素数是>> 5,而2 3 5 7 9 ..p是素数的第一个素数是5 = n = 2 。看到5是素数,5 + 2 = 7也是素数。

我建议您查看函数primes(),它将帮助您入门。另请参阅find()