Class PE0046

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ArrayList<java.lang.Integer> primes
      Storage for all primes that can occur less than one million.
    • Constructor Summary

      Constructors 
      Constructor Description
      PE0046()
      A simple constructor to set number and title.
    • Method Summary

      Modifier and Type Method Description
      void prepare()
      It initializes the list of primes with values less than 1.000.000 using the Sieve class.
      java.lang.String solve()
      It solves the problem by checking every odd beginning with 3 if: it is no prime there is a prime when a double square is subtracted It stops execution when an odd is found where both condition do not match.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • primes

        private java.util.ArrayList<java.lang.Integer> primes
        Storage for all primes that can occur less than one million.
    • Constructor Detail

      • PE0046

        public PE0046()
        A simple constructor to set number and title.
    • Method Detail

      • solve

        public java.lang.String solve()
        It solves the problem by checking every odd beginning with 3 if:
        1. it is no prime
        2. there is a prime when a double square is subtracted
        It stops execution when an odd is found where both condition do not match.
        Returns:
        the first found odd that does not match the both conditions