Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Wednesday, September 9, 2015

(divisors z) → (Listof Natural)
z : Integer
Returns a list of all positive divisors of the integer z. The divisors appear in ascending order.

Another reason why Racket rocks, because optimizing trial-division for large numbers.

It makes solving the Fermat Exponent problem easy:

Apparently, there was a period of time in Beethoven's transition from classical formalist to bombastic romanticist (possibly accompanied by severe hearing loss and disillusionment with Napoleon) when musicians said, (translated from 19th-century German), "What the heck, Beethoven! This isn't music! My kids could write this!"

Elsewhere:

Wednesday, July 29, 2015

One-swap sorting problem in common lisp.

One-swap sorting problem in common lisp.

Given an array of unique integers, determine if it is possible to sort the array by swapping two elements of the array. For instance, the array [1,2,6,4,5,3,7] can be sorted by swapping 3 and 6, but there is no way to sort the array [5,4,3,2,1] by swapping two of its elements. You may use O(n) time, where the array has n integers, and constant additional space.

Monday, July 6, 2015

Two Programming Links

Two programming links:

NASA fixed a bug in New Horizons a week before it hurtles by Pluto. They're working with a nine-hour delay.

Grant Rettke discusses lisp, forth, and minimalist programming.

Thursday, June 18, 2015

Artist: Google's Image Recognition Engine

Neural net hallucination caused by force-feeding Google's image recognition engine.

If we apply the algorithm iteratively on its own outputs and apply some zooming after each iteration, we get an endless stream of new impressions, exploring the set of things the network knows about. We can even start this process from a random-noise image, so that the result becomes purely the result of the neural network, as seen in the following images:

Inceptionism: Going Deeper into Neural Networks Alexander Mordvintsev, Christopher Olah, and Mike Tyka, @ Google Research

Tuesday, June 9, 2015

Saturday, June 6, 2015

Racket and Identicons

Using Racket to generate identicons:

I’ve always liked identicons, which WordPress and GitHub have used to great effect. The premise is simple: take a user identifier such as an IP or email address and deterministically convert it into an image based on a simple algorithm. To that I end I started hacking on Identikon - a little Racket program that generates different types of identicons based on rules modules.

Wednesday, June 3, 2015

Disable emacs ido caching for bad directories on windows

I’ve been having a problem with ido screwing up on windows. Here is a fix.

;;disable ido caching on windows
(require 'ido)
(when (equal system-type 'windows-nt)
  (setq ido-max-dir-file-cache 0)
  (add-to-list 'ido-work-directory-list-ignore-regexps
           "Local Settings")
  (add-to-list 'ido-work-directory-list-ignore-regexps
           "Application Data"))

Pastebin link