简体   繁体   中英

Java program taking list of primes and gives as output the string of symbols to corresponding G ̈odel statement

I am trying to write a program for a coding problem for class. I was thinking of doing a while loop asking for the list of primes and the somehow comparing them to a string. Down below is my code. I know its rough. Any one pointing me in the right direction would help.

 public static void godel(){
            Scanner scanner = new Scanner(System.in);
            System.out.println("Enter a list of primes: ");
            System.out.println("0 to stop loop ");
            int input =0;
            int count = 0;

            //string 0 = int 1;
            //string f = int 3;
            //string -\ = int 5;
            //string V = int 7;
            //string \-/ = int 9;
            //string ( = int 11;
            //string ) = int 13;
            //string /\ = int 15;
            //string 3 = int 17;
            //string = = int 19;
            //string x = int 21;
            //string y = int 23


            while(true){
                input = scanner.nextInt();

                if (input != 0)
                {
                    input += count;

                }
                else{
                    System.out.println("Here are your list of primes in Godel's Number");
                    System.out.println(count);
                    break;

            }



            }     }

I assume nothing is working?

first off, you need "public static void main(String[] args)" for anything to pop up. The code you want to execute (not any of the helper functions or math, just want you want to print) should be within that statement as such

public static void main(String[] args)
{
    //code you want to execute here
}

I'm not sure what the godel stuff is, also you need to import the scanner library like this at the top of the code:

import java.util.Scanner; 

I don't know if you need to hear any of this, but this looks like a runner because your printing out a lot of stuff and you have a scanner. I was confused as to why there was no args statement or library but I guess you maybe just didn't include it.

I no nothing about number theory so I can't help with that part.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM