import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { /* 1.Rephrase We have a game where for a given set of integers from 1-n two players alternate in picking a prime number and all of its multiples. The first player that runs out of primes looses.. Find the winning player given n, and that Alice always goes first. 2.I/O Input: number of integers in the set Output: Print of Winner 3.Signature static void printWinner(int n) 4.Exammples a. n=5 _______ 1, 2, 3, 4, 5 Alice -> picks 2, 4 Bob -> picks 3 Alice -> picks 5, Bob -> looses b. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 _____________________________ Alice -> picks 2 5.Solution a. Find the number of primes in the set, if it's even Bob wins, if odd Alice wins */ static int getNumberOfPrimes(int n){ List primes = new ArrayList(); primes.add(2); for(int i = 3; i <= n ; i++){ boolean isPrime = true; for(Integer prime: primes){ if(i%prime == 0){ isPrime = false; } } if(isPrime){ primes.add(i); } } return primes.size(); } static void printWinnder(int n){ if(n == 1){ System.out.println("Bob"); return; } int numberOfPrimes = getNumberOfPrimes(n); if(numberOfPrimes%2 == 0){ System.out.println("Bob"); }else{ System.out.println("Alice"); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int g = in.nextInt(); for(int a0 = 0; a0 < g; a0++){ int n = in.nextInt(); printWinnder(n); } } }