@@ -0,0 +1,2981 @@
+import java.util.*;%0Aimport java.util.function.Function;%0Aimport java.util.stream.Collectors;%0Aimport java.util.stream.IntStream;%0A%0A@SuppressWarnings(%22unused%22)%0Apublic class P060 implements Puzzle %7B%0A%0A%0A    @Override%0A    public String solve() %7B%0A%0A        final Set%3CInteger%3E sprimes = Util.primes(100000000);%0A        final List%3CInteger%3E primes = sprimes.stream()%0A                .parallel()%0A                .filter(i -%3E i %3C 10000)%0A                .sorted()%0A                .collect(Collectors.toList());%0A%0A        final Map%3CInteger, Set%3CInteger%3E%3E map = primes.stream()%0A                .collect(Collectors.toMap(Function.identity(), p -%3E new HashSet%3C%3E()));%0A%0A        for (int iIndex = 1; iIndex %3C primes.size(); ++iIndex) %7B%0A            final int i = primes.get(iIndex);%0A            final String iString = String.valueOf(i);%0A%0A            for (int j : primes.subList(iIndex + 1, primes.size())) %7B%0A                final String jString = String.valueOf(j);%0A                if (sprimes.contains(Integer.valueOf(iString + jString)) &&%0A                        sprimes.contains(Integer.valueOf(jString + iString))) %7B%0A                    map.get(i).add(j);%0A                    map.get(j).add(i);%0A                %7D%0A            %7D%0A        %7D%0A%0A%0A        for (int aIndex = 0; aIndex %3C primes.size(); ++aIndex) %7B%0A            final Integer a = primes.get(aIndex);%0A            final Set%3CInteger%3E set = map.get(a);%0A%0A            for (int bIndex = aIndex + 1; bIndex %3C primes.size(); ++bIndex) %7B%0A                final Integer b = primes.get(bIndex);%0A                final Set%3CInteger%3E bSet = map.get(b);%0A%0A                if (bSet.contains(a)) %7B%0A                    for (int cIndex = bIndex + 1; cIndex %3C primes.size(); ++cIndex) %7B%0A                        final Integer c = primes.get(cIndex);%0A                        final Set%3CInteger%3E cSet = map.get(c);%0A%0A                        if (cSet.contains(a) && cSet.contains(b)) %7B%0A                            for (int dIndex = cIndex + 1; dIndex %3C primes.size(); ++dIndex) %7B%0A                                final Integer d = primes.get(dIndex);%0A                                final Set%3CInteger%3E dSet = map.get(d);%0A%0A                                if (dSet.contains(a) && dSet.contains(b) && dSet.contains(c)) %7B%0A                                    for (int eIndex = dIndex + 1; eIndex %3C primes.size(); ++eIndex) %7B%0A                                        final Integer e = primes.get(eIndex);%0A                                        final Set%3CInteger%3E eSet = map.get(e);%0A%0A                                        if (eSet.contains(a) && eSet.contains(b) && eSet.contains(c) && eSet.contains(d)) %7B%0A                                            return %22%22 + (a + b + c + d + e);%0A                                        %7D%0A                                    %7D%0A                                %7D%0A                            %7D%0A                        %7D%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A%0A        throw new RuntimeException(%22no solution found%22);%0A    %7D%0A%0A%7D

add 60