Class PE0050

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ArrayList<java.lang.Integer> candidates
      A memory for all primes less than one million.
      private int limit
      The maximum for the wanted prime.
    • Constructor Summary

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

      Modifier and Type Method Description
      void prepare()
      Within the preparation of this problem all candidates less than 1.000.000 are collected using a Sieve.
      java.lang.String solve()
      This method solves the given problem by adding all consecutive candidates.
      • Methods inherited from class java.lang.Object

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

      • candidates

        private java.util.ArrayList<java.lang.Integer> candidates
        A memory for all primes less than one million.
      • limit

        private int limit
        The maximum for the wanted prime.
    • Constructor Detail

      • PE0050

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

      • solve

        public java.lang.String solve()
        This method solves the given problem by adding all consecutive candidates. The maximum found sum less than 1.000.000 that is a prime is returned.
        Returns:
        the biggest prime less than one million that is formed as a sum of primes