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 count = 0; for(int i=0;i=2;k--){ if(ispower2(k)){ divisor = k; break; } } //System.out.println("divisor is "+ divisor); return divisor; } private static boolean ispower2(long num){ return num!=0 && (( num& num-1 )== 0); } private static long recursionSequence(long num){ if(num == 1) return 0; else{ long divisor = maxdivisor(num); return (num/divisor) + (num/divisor)*recursionSequence(divisor); } } }