Recognize Twin Primes by Crashing Background Story

Bob was handed the following assignment for his programming class. Please note: this is not the actual challenge.


  Homework assignment 11: Twin primes
  
  Input: an integer n &ge; 8, taken from STDIN.
  
  Output: a message to STDOUT, depending on n:
  
  
  If n is not a prime number, output Not prime.
  If n is a prime number, but neither of n - 2 and n + 2 is, output Isolated prime.
  If n and n + 2 are both prime numbers, output Lower twin prime.
  If n and n - 2 are both prime numbers, output Upper twin prime.
  


Bob tried hard to solve the assignment, but his program kept crashing, and in the end, he gave up and submitted it in hope of partial credit. Nevertheless, Bob's program has the curious property that even though it never does what it's supposed to, the input is still classified correctly depending on the program's behavior: non-primes result in no output, isolated primes in a crash, lower twin primes in an infinite loop with no output, and upper twin primes in an infinite loop that keeps printing the correct message.

The Task

Your task is to replicate the behavior or Bob's solution. In other words, write a program that reads a single integer n &ge; 8 from STDIN or closest equivalent, and does the following:


If n is not a prime number, output nothing and exit gracefully.
If n is a prime number, but none of n - 2 or n + 2 is, produce a runtime error of some kind. Stack overflows count as runtime errors.
If n and n + 2 are both prime numbers, output nothing, but keep running until the program is killed manually (or until you run out of memory).
If n and n - 2 are both prime numbers, repeatedly output Upper twin prime., with or without a trailing newline, to STDOUT or closest equivalent until the program is killed manually (or until you run out of memory).


Incorrect inputs can be ignored.

Scoring

The idea is that your program should appear correct, but contain hidden bugs that result in the above behavior. Your program should also be short (since programming assignments are graded by hand), but popularity is more important. Thus, your score is number of upvotes - (byte count / 100), higher score being better. Note that your score can be negative.
TI-BASIC, ~269

Input N
Lbl 1
2→P                                       :"  test N for divisibility by each prime
Lbl 2
If int(N/P)=N/P:Goto 3    :"composite"
If PP&gt;N:Goto 4
P+1→P
Goto 2
Lbl 3
Disp "                NOT PRIME.               "
Stop
Lbl 4
If int((N+2)/3)=(N+2)/3                    :" determine which nearby value to test
Then:N-2→R
Else:N+2→R
End
2→P
Lbl 5
If int(R/P)=R/P:Goto 6    :"composite"
If PP&gt;R:Goto 7
P+1→P
Goto 5
Lbl 6
Output("ISOLATED PRIME.")
Lbl 7          :" TI-BASIC how two ways of printing:
               :" Disp goes to the main screen,
               :" and Output goes to the graphical screen.
               :" This program uses both methods.
If R=N+2:Goto 5              :" go to print "lower twin prime"
Disp "UPPER TWIN PRIME"
Goto 7          :" only 16 chars can be printed per line, so we'll do the period separately (last line of program)
Lbl 5
Output("LOWER TWIN PRIME")
Lbl 7
Disp "."



   The NOT PRIME string has sixteen leading spaces, so nothing (except an ellipsis) will be printed, as noted in the comments.
 The ISOLATED PRIME string uses the Output() function, which requires two numbers (the coordinates of the printing location). This triggers an Argument Error.
 The LOWER TWIN PRIME string is indicated by the link to Lbl 5, which was already defined as the start of the twin prime test, causing an infinite loop.
 The UPPER TWIN PRIME string is followed by a link to the period, but Lbl 7 was already defined above, triggering an infinite loop.