Class PE0060

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ArrayList<java.lang.Integer> candidates  
    • Constructor Summary

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

      Modifier and Type Method Description
      void prepare()
      All primes between 2 and 10.000 are stored as candidates using a Sieve.
      java.lang.String solve()
      Solves this problem by run five nested loops but every inner loop is shorter than the outer.
      private boolean testPrimePairs​(java.lang.String... arr)
      Tests if all given strings create new primes by concatenating them pairwise in both directions.
      • 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
    • Constructor Detail

      • PE0060

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

      • solve

        public java.lang.String solve()
        Solves this problem by run five nested loops but every inner loop is shorter than the outer.
        Returns:
        the sum of the first five primes that matches the condition
      • testPrimePairs

        private boolean testPrimePairs​(java.lang.String... arr)
        Tests if all given strings create new primes by concatenating them pairwise in both directions.
        Parameters:
        arr - an array of strings
        Returns:
        true if all strings in the array create primes pairwise