Created
October 31, 2012 09:33
-
-
Save kana/3986088 to your computer and use it in GitHub Desktop.
Solving VimGolf http://vimgolf.com/challenges/4d1c27940e3d7832db000010
This file contains 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
:function! F() | |
let xs = [2] | |
let i = 3 | |
while len(xs) < 100 | |
if empty(filter(copy(xs), 'i % v:val == 0')) | |
call add(xs, i) | |
endif | |
let i += 1 | |
endwhile | |
put =xs | |
1 delete | |
endfunction | |
:call F() | |
:wq |
This file contains 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
:fu F() | |
let s=[2] | |
let i=3 | |
wh len(s)<100 | |
if empty(filter(copy(s),'i%v:val==0')) | |
cal add(s,i) | |
en | |
let i+=1 | |
endw | |
pu=s | |
1d | |
endf | |
:cal F() | |
ZZ |
This file contains 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
:pu=filter(range(2,541),'filter(range(2,v:val-1),v:val.''%v:val==0'')==[]')|1d | |
ZZ |
This file contains 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
:pu=filter(range(2,541),'repeat(''x'',v:val)!~''\v^(xx+)\1+$''')|1d | |
ZZ |
This file contains 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
:pu=filter(range(2,541),'repeat(8,v:val)!~''\v^(88+)\1+$''')|1d | |
ZZ |
This file contains 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
:pu=map(range(2,541),'repeat(8,v:val)')|g/\v^(88+)\1+$/d | |
qaC=len(@-) | |
k0q99@addZZ |
This file contains 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
SxxqaYpAxq540@a:g/\v^(xx+)\1+$/d | |
qbC=len(@-) | |
k0q99@bZZ |
This file contains 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
S qa>>Ypq540@a:g/\v^( +)\1+$/d | |
qb0C=len(@-) | |
kq99@bZZ |
This file contains 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
S 0qa>>Ypq540@a:g/\v^( +)\1+0/d | |
qb/ | |
xq99999@bZZ |
This file contains 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
S 1qa>>Ypq540@a:g/\v^( +)\1+\d/d | |
:%s/ //g|wq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment