Skip to content

Instantly share code, notes, and snippets.

View twedl's full-sized avatar
💭
🦕

twedl twedl

💭
🦕
View GitHub Profile
@twedl
twedl / README.md
Last active August 29, 2015 14:03
Project Euler #1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.

I start with the example of N=150. The algorithm:

  1. Set sum to 0.
  2. Loop from n=1 to N.
    1. if n is divisible by 3 or 5, add n to sum.

Things to consider:

  1. Do I want to match the algorithm perfectly? Then there wouldn't be different colours or levels, just "Add" or "Ignore".
@twedl
twedl / README.md
Created July 2, 2014 23:47
Southern BC Population by Subdivision
@twedl
twedl / README.md
Last active August 29, 2015 14:03
Canadian Population by Subdivision
@twedl
twedl / README.md
Last active August 29, 2015 14:03
US Population by County
@twedl
twedl / README.md
Last active January 7, 2016 03:29
Project Euler #2

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

This time I'm going to try to highlight the algorithm more. I.e., type out the algorithm next to the diagram and highlight which part is working.

Looks like the style for complex animations is (see this block). Chained transitions! Global variables to iterate over. Then:

  1. setTimeout(function () { ... })
@twedl
twedl / README.md
Last active January 6, 2016 13:14
Erdos-Renyi Random Graph
@twedl
twedl / README.md
Last active January 7, 2016 03:27
Dynamic Erdos-Renyi Graph

Visualize an Erdos-Renyi random graph, dynamically. (That is, the visualization is dynamic, not the graph.)

Some resources: Many examples from Mike Bostock and D3 Noob, and here.

@twedl
twedl / README.md
Last active January 7, 2016 02:48
Small-world Random Graph

Draw a ring-lattice with links to each node's nearest neighbours (distance <=2).

@twedl
twedl / README.md
Last active January 7, 2016 03:48
Uniform Attachment for Erdos-Renyi Graph

Visualize a dynamic uniform attachment model.

@twedl
twedl / README.md
Last active April 27, 2016 12:29
Preferential attachment model.

Visualize a dynamic preferential attachment model.