// Write a java program using multithreading for the following: 1.
Display all
// the odd numbers between 1 to n. 2. Display all the prime numbers between 1
// to n
import java.io.*;
@SuppressWarnings("ALL")
class MyThread implements Runnable {
   int i, n;
   Thread t1;
  MyThread() {
    t1 = new Thread(this, "Odd");
    t1.start();
  }
  public void run() {
    try {
       Thread.sleep(1000);
       for (i = 1; i <= n; i = i + 2) {
          Thread.sleep(1000);
          System.out.println(i);
       }
    } catch (Exception obj) {
       System.out.println(obj);
    }
  }
  public void run2(){
    try {
        int count;
        Thread.sleep(1000);
        for (int i = 1; i <= n; i++) {
           count = 0;
           Thread.sleep(1000);
           for (int j = 2; j <= i / 2; j++) {
              if (i % j == 0) {
                  count++;
                  break;
              }
           }
           if (count == 0) {
               System.out.println(i);
           }
        }
     } catch(Exception obj) {
            System.out.println(obj);
        }
    }
}
class m7 {
   public static void main(String[] args) throws Exception {
     MyThread obj = new MyThread();
     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
     System.out.println("Enter Range Value");
     obj.n = Integer.parseInt(br.readLine());
        System.out.println("Odd Number : ");
        obj.run();
        System.out.println("Prime Number : ");
        obj.run2();
    }
}