In: Computer Science
a) write a program to compute and print n, n(f), f(f(n)), f(f(f(n))).........for 1<=n<=100, where f(n)=n/2 if n is even and f(n)=3n+1 if n is odd
b) make a conjecture based on part a. use java
public class Conjecture { public static int f(int n) { if (n % 2 == 0) { return n/2; } else { return 3*n + 1; } } public static void main(String[] args) { for (int n = 1; n <= 100; n++) { System.out.printf("n = %d, f(n) = %d, f(f(n)) = %d, f(f(f(n))) = %d\n", n, f(n), f(f(n)), f(f(f(n)))); } } }