import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static boolean isPrime(int n) { //check if n is a multiple of 2 if (n%2==0) return false; //if not, then just check the odds for(int i=3;i*i<=n;i+=2) { if(n%i==0) return false; } return true; } public static int largestPrimeFactor(long number) { int i; for (i = 2; i <= number; i++) { if (number % i == 0) { number /= i; i--; } } return i; } public static int ls(long a){ int eat = 0; if(a==1) return eat++; if(isPrime((int)a)) return a+1; if(a%2==0) return (1+2*(ls(a/2))); if(!isPrime((int)a)&&a%2!=0) return (largestPrimeFactor(a)+1); return 0; } public static int longestSequence(long[] a) { int count=0; for(int j=0;j