import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long dp[]=new long[1000000];dp[0]=1;dp[1]=1; for(int i=2;i<10000;i++) { int j=2; while(i%j!=0&&j<=i){j++;} if(i==j){dp[i]=i+1;continue;} int temp=j; while(j