pta 乙级1013 java 测试点156

//1013
import java.util.Scanner;
public class Main {
//                输出素数
    public static void print(int p,Long i){
        if(p%10!=0){
            System.out.print(i+" ");
        }
        else if(p%10==0){
            System.out.print(i+"\n");
        }
    }
//            找素数
    public static boolean isPrime(long i){
        for(int j=2;j*j<=i;j++){
            if(i%j==0){
                return false;
            }
        }
        return true;
    }
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int m=in.nextInt();
        int n=in.nextInt();
        int t=0;
        int p=0;
        for(long i=1;i>0;i+=2){
            if(isPrime(i)==true){
                t++;
                if(t>=m&&t<n){
                    p++;
                    print(p,i);
                }
                else if(t==n){
                    System.out.print(i);
                    break;
                }
            }
        }
    }
}

测试点1 5 6 过不去,求大佬帮助

你的代码有问题,当m = 1的时候,你的代码不输出2
正确的代码思路
https://blog.csdn.net/weixin_45031646/article/details/95056083

我用C写的,也是156测试点没过,问题出在1不是素数而2是素数