Project Euler > Problem 79 > Passcode derivation (Java Solution)


A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.

The text file, keylog.txt, contains fifty successful login attempts.

Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible secret passcode of unknown length.



The solution may include methods that will be found here: .

public interface EulerSolution{

public String run();

* Solution to Project Euler problem 29
* By Nayuki Minase

import java.math.BigInteger;
import java.util.HashSet;
import java.util.Set;

public final class p029 implements EulerSolution {

public static void main(String[] args) {
System.out.println(new p029().run());

public String run() {
Set<BigInteger> generated = new HashSet<BigInteger>();
for (int a = 2; a <= 100; a++) {
for (int b = 2; b <= 100; b++)
return Integer.toString(generated.size());


No comments :

Post a Comment

Follow Me

If you like our content, feel free to follow me to stay updated.


Enter your email address:

We hate spam as much as you do.

Upload Material

Got an exam, project, tutorial video, exercise, solutions, unsolved problem, question, solution manual? We are open to any coding material. Why not upload?


Copyright © 2012 - 2014 Java Problems  --  About  --  Attribution  --  Privacy Policy  --  Terms of Use  --  Contact