Skip to content

Instantly share code, notes, and snippets.

;;
;; The number, 1406357289, is a 0 to 9 pandigital number because it is made
;; up of each of the digits 0 to 9 in some order, but it also has a rather
;; interesting sub-string divisibility property.
;; Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we note the following:
;; d2d3d4=406 is divisible by 2
;; d3d4d5=063 is divisible by 3
;; d4d5d6=635 is divisible by 5
;; If p is the perimeter of a right angle triangle with integral length sides,
;; {a,b,c}, there are exactly three solutions for p = 120.
;; {20,48,52}, {24,45,51}, {30,40,50}
;; For which value of p <= 1000, is the number of solutions maximised?
;; http://projecteuler.net/problem=39
; Any triple of positive integers can serve as the side lengths of an integer
; In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
; 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
; It is possible to make £2 in the following way:
; 1x£1 + 1x50p + 2x20p + 1x5p + 1x2p + 3x1p
; How many different ways can £2 be made using any number of coins?
;
; http://projecteuler.net/problem=31
@xavi
xavi / gist:3729307
Created September 15, 2012 18:57
Fast, simple, powerful templating in Clojure
;; Call the renderer-fn macro with a template and it returns a function optimized to render it.
;; This happens at compile-time.
;; At run-time, you call this function with the parameters that will be interpolated into the template,
;; typically (but not limited to) a map.
;;
;; Useful in i18n for variable interpolation, for example. I'm using this to add internationalization
;; support to https://github.com/xavi/noir-auth-app
;; See usage at the end.