Blinking primes

This is an updated uLisp version of the classic Aduino Blink program, traditionally used to verify that your Arduino board is working correctly.

This one blinks out the series of prime numbers on the built-in LED, starting with 2, 3, 5, 7, 11, etc, up to the largest integer that 8/16‑bit versions of uLisp can represent, 32767. You could also use this to demonstrate the existence of intelligent life to visiting aliens.

First, the routine prime returns t if its argument is prime, and nil if it's composite:

(defun prime (n)
  (let ((d 2))
    (loop
     (when (> (* d d) n) (return t))
     (when (zerop (mod n d)) (return nil))
     (incf d))))

Here's the blink program:

(defun blink ()
  (pinmode :led-builtin t)
  (dotimes (x 32767)
    (when (and (> x 1) (prime x))
      (dotimes (f (* x 2))
        (digitalwrite :led-builtin (evenp f))
        (delay 250))
      (delay 1500))))

Call it with:

(blink)

It will run on any uLisp platform.