Intelligence over simple data
It depends on the algorithm.  

A classical algorithm would not be able to recognize the pattern of primes unless it was programmed to do so.  This pre-programming would not have to be exclusive to primes, but the algorithm would have to "understand" the nature of primes including 1 (the number can only be divided by 1 and itself.)

Because computers are good at number crunching, it should be quite possible to program an algorithm that looks for numerical relationships, such as primes, parity and factors, without being taught those specific concepts. 

Extending this to alternate representations of numbers, 1=1, 11=2, 111=3 requires a type of abstract thinking (i.e. the literal representation is not the true meaning. In an 8-bit byte 11101101 = 237. In Base-2 1,11,111 are the primes 1,3,7;) 

However, if the algorithm was superintelligent, figuring out the example would be trivial, and, ostensibly, correctly deriving patterns of any kind, no matter how opaque, would be possible, given enough time and memory.