Skip to content

Instantly share code, notes, and snippets.

View aomoriringo's full-sized avatar
🏠
Working from home

aomoriringo aomoriringo

🏠
Working from home
View GitHub Profile
source ./bigint.vim
function! Fib(n) abort
let [a,b,i] = [FromString("0"),FromString("1"),0]
while i < a:n
let [a,b,i] = [b,BigAdd(a,b),i+1]
endwhile
return ToString(a)
endfunction
@aomoriringo
aomoriringo / p003.vim
Last active August 29, 2015 14:18
Project Euler 003
reltime: 54.894354
let g:bigint = {'num': [], 'sign': 1}
let g:nodeMaxDigit = 8
let g:nodeMaxNum = 100000000
function! Isdigit(str)
return match(a:str, '^[+-]\?\d\+$') != -1
endfunction
function! StringToBigint(str)
if Isdigit(a:str) != 1
let s:name = 'World'
echo "\nHello" . s:name
function! Isdigit(str)
return match(a:str, '^[+-]\?\d\+$') != -1
endfunction
let g:bigint = {'num': [], 'sign': 1}
let g:nodeMaxDigit = 8
x27[32;01m * x27[39;49;00mPackage: dev-lang/R-3.1.2
x27[32;01m * x27[39;49;00mRepository: gentoo
x27[32;01m * x27[39;49;00mMaintainer: calchan@gentoo.org sci-mathematics@gentoo.org
x27[32;01m * x27[39;49;00mUSE: abi_x86_64 amd64 elibc_glibc kernel_linux nls openmp readline userland_GNU
x27[32;01m * x27[39;49;00mFEATURES: preserve-libs sandbox userpriv usersandbox
x27[32;01m*x27[0m Using following Fortran compiler:
x27[32;01m*x27[0m F77: x86_64-pc-linux-gnu-gfortran
x27[32;01m*x27[0m FC: x86_64-pc-linux-gnu-gfortran
x27[32;01m*x27[0m x86_64-pc-linux-gnu-gfortran has OPENMP support
>>> Unpacking source...
@aomoriringo
aomoriringo / result
Last active August 29, 2015 14:13
uzumaki
>>> from uzumaki import *
>>> [uzumaki(x) for x in range(20)]
[(0, 0), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1), (2, -1), (2, 0), (2, 1), (2, 2), (1, 2), (0, 2), (-1, 2), (-2, 2), (-2, 1), (-2, 0), (-2, -1)]
>>> uzumaki(1000000000)
(1683, -15811)
@aomoriringo
aomoriringo / progress karaoke
Last active August 29, 2015 14:03
進捗カラオケ
switch(i%4):
case 0:
thinca
case 1:
kyubuns
case 2:
supermomonga
case 3:
aomoriringo
"""""""""""""""""""""
" general
"""""""""""""""""""""
set number
set tabstop=2
set laststatus=2
set t_Co=256
set expandtab
set noswapfile
@aomoriringo
aomoriringo / gist:7706985
Last active October 19, 2021 21:59
任意画像の輪郭を数式に変換してプロットする (Mathematica ver.8)
(* parameters *)
(* 最大次数 *)
maxOrderNum = 200;
(* 画像URL, もしくはローカルパス *)
imageURL = "http://nex.fm/wp-content/uploads/2012/08/vim-editor_logo.png";
pointListToLines[pointList_, neighbothoodSize_: 6] :=
Module[{L = DeleteDuplicates[pointList], NF, lambda,
lineBag, counter, seenQ, sLB, nearest,
nearest1, nextPoint, couldReverseQ, d, n, s},
@aomoriringo
aomoriringo / gist:3683301
Created September 9, 2012 08:19
Project Euler Problem 8 with hs
import Data.Char
main = do
l <- getLine
let nums = map digitToInt l
putStrLn $ show $ maxNum nums
maxNum :: [Int] -> Int
maxNum [] = 0
maxNum all@(x:xs) = max (product (take 5 all)) (maxNum xs)