solution_diophantine_prime.m
来自「这是我用matlab编写的一个解不定方程的程序」· M 代码 · 共 29 行
M
29 行
%judge that a nature number is a prime or not
function solution_diophantine_prime(cir_num_start,cir_num_end,cir_interval)
value_n=0;
value_n_divide_3=0;
for j=cir_num_start:cir_interval:cir_num_end;
%disp(sprintf('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'));
if j/3==floor(j/3)
if isprime(j/3)==1;
value_n=j
disp(sprintf('the nature number is a prime'));
%cir_num=((j-cir_num_start)/cir_interval)+1
value_n_divide_3=j/3
if mod(j/3-1,6)==0;
disp(sprintf('*********************************the value is 1 after mod 6*********************************'));
solution_diophantine(j)
else
value_n_divide_3_mod_6=mod(value_n_divide_3,6)
disp(sprintf('!!!!!!the value is not 1 after mod 6!!!!!!'));
solution_diophantine(j)
end
else
% value_n=j
% disp(sprintf('the nature number is not a prime'));
end
else
% value_n=j
% disp(sprintf('!!!!!!!!!!!!!!!!!!!!!!!the nature number can not be divided exactly by 3!!!!!!!!!!!!!!!!!!!!!!!'));
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?