Consider this primality test: Fix an initial segment of primes (e.g. 2,3,5,7), and combine a $b$-pseudoprime test for each b in that list... Consider this primality test: Fix an initial segment of primes (e.g. 2,3,5,7), and combine a $b$-pseudoprime test for each b in that list. For several such initial segments, find the first $n$ for which the test gives an incorrect answer.
Hey all! I'm not quite understanding what the aforementioned question is asking... So help would be handy. :)
My code:
primetest1 := proc 
  (Numprimes, N) local i, j; 
    for i to Numprimes do 
     for j to N do 
       if `mod`(ithprime(i)^(j-1), j) = 1 then
         if isprime(j) = false then print(j*"is a false answer") 
           end if 
         end if 
      end do 
     end do 
  end proc

 A: My interpretation  is as follows:
Taking some group of primes  $p_i =\{2,3,\ldots\}$, then for numbers $n$ in turn not divisible by any of these, apply the Fermat pseudoprime test using each $p_i$ to each $n$:
$$ p_i^{n-1} \equiv1 \bmod n \implies n \text{ is prime} $$
Find the first number that gets this test wrong.

In the case of $\{2,3,5\}$, the first non-prime that appears to be a prime under this assessment is $1729$, followed by $2821$ and $6601$.

First five to fail for each group of primes...
$$\begin{array}{c|c|c|c}
\{2\} & \{2,3\} & \{2,3,5\} & \{2,3,5,7\} \\ \hline
341 & 1105 & 1729 & 29341 \\
561 & 1729 & 2821 & 46657 \\
645 & 2465 & 6601 & 75361 \\
1105 & 2701 & 8911 & 115921 \\
1387 & 2821 & 15841 & 162401 \\
\end{array}$$
A: I'm assuming what it means is given an initial segment of primes (the first $n$ primes). for example the numbers $2,3,5$ Use this number to test if a number is prime or not. That is: check wheter a number is divisible by $2,3$ and $5$. Clearly if it is the number is not prime.
If the number is not divisible by any of them assume this test tells you the number is a prime. Of course this is not true. The question presumably asks you to find the firs non-prime number that passes the prime test.
For example, when you take $2,3,5$ the first non-prime number that passes the test is $49$  since it is not prime and not divisible by either of those primes. In fact the first counterexample will always be the square of the smallest prime yu didn't take (in this case 7).
