fork download
  1. import java.util.Scanner;
  2. import java.math.BigInteger;
  3.  
  4. class codeabbey67
  5. {
  6. public static void main(String[] Args)
  7. {
  8. Scanner input = new Scanner(System.in);
  9. System.out.print("\n\nSets: ");
  10. int sets = input.nextInt();
  11. int A[] = new int[sets];
  12. for(int i = 0; i<sets; i++)
  13. {
  14. BigInteger next = BigInteger.ZERO;
  15. BigInteger val = input.nextBigInteger();
  16. System.out.println("\nVAL: " + val);
  17. int x = 0;
  18. while(!next.equals(val) && x!= 100) //until current value at position in sequence equals desired value
  19. {
  20. if(x<= 1)
  21. {
  22. next = BigInteger.ONE;
  23. x++;
  24. }
  25. next = f.add(s);
  26. System.out.println("Next: " + next);
  27. s = next;
  28. x++;
  29. }
  30. A[i] = x;
  31. }
  32. for(int y = 0; y<A.length; y++)
  33. System.out.print(A[y] + " ");
  34. }
  35. }
Success #stdin #stdout 0.17s 321344KB
stdin
1
13
stdout

Sets: 
VAL: 13
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
Next: 1
100