This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| my @res; | |
| sub calc { | |
| eval join '+', map {$_**2} split //, shift; | |
| } | |
| for my $i (1..50) { | |
| my %hash, $num = calc $i; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open $fh, 'words.txt'; | |
| push @sums, unpack "%32C*", (chomp $_, $_) while <$fh>; | |
| close $fh; | |
| print eval join '+', (sort { $a <=> $b } @sums)[-42..-1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my %sets = (); | |
| sub check { | |
| my ($x, $y) = @{$_[0]}; | |
| return if (exists $sets{$x.','.$y} || (eval join "+", (abs $x . abs $y)=~/./g) > 19); | |
| $sets{$x.','.$y} = 1; | |
| check($_) foreach ([$x + 1, $y], [$x - 1, $y], [$x, $y + 1], [$x, $y - 1]); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.time('luke20') | |
| var sets = {}, size = 0 | |
| var sum = function (x, y) { | |
| var num = Math.abs(x).toString() + Math.abs(y) | |
| return parseInt(eval(num.replace(/(\d)(?=\d)/g, '$1+'))) | |
| } | |
| var check = function (x, y) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for (var d = new Date(1337, 0, 1), c = 0, date = new Date(Date.now()); d <= date; d.setMonth(d.getMonth() + 1), d.setDate(13)) { | |
| if (d.getDay() === 5) | |
| ++c | |
| } | |
| console.log(c); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.time('luke9'); | |
| loop1: | |
| for (var i = 203; i < 498; i++) { | |
| for (var j = 987; j > 501; j--) { | |
| if (('' + i + j + (i+j)).split('').sort().join('') === '0123456789') { | |
| console.log(Math.min(i, j)) | |
| break loop1 | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $R = 6371; | |
| $dLat = deg2rad($lat2-$lat1); | |
| $dLon = deg2rad($lon2-$lon1); | |
| $lat1 = deg2rad($lat1); | |
| $lat2 = deg2rad($lat2); | |
| $a = sin($dLat/2) * sin($dLat/2) + sin($dLon/2) * sin($dLon/2) * cos($lat1) * cos($lat2); | |
| $c = 2 * atan2(sqrt($a), sqrt(1-$a)); | |
| $d = $R * $c; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| file = thesis | |
| TEX = pdflatex -shell-escape -interaction=nonstopmode -file-line-error | |
| .PHONY: thesis.pdf all clean | |
| all: thesis.pdf | |
| thesis.pdf: thesis.tex | |
| latexmk -pdf -pdflatex="pdflatex -shell-escape -interaction=nonstopmode -file-line-error" -use-make thesis.tex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "font_size": 13, | |
| "ignored_packages": | |
| [ | |
| "Vintage" | |
| ], | |
| "theme": "Spacegray.sublime-theme", | |
| "color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme", | |
| "wrap_width": 120, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var connect = require('connect') | |
| , http = require('http') | |
| , vhost = require('vhost') | |
| /* Apps | |
| ------------------------------------------------------------------------------*/ | |
| var app = connect() | |
| var bybussen_api = require('bybussen') | |
| var tmn = require('/vhosts/tmn.io') |