Created
July 8, 2013 14:54
-
-
Save egisatoshi/5949537 to your computer and use it in GitHub Desktop.
Playing with prime numbers with Egison
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
/home/egi/egison3% egison [0] | |
Egison Version 3.0.8 (C) 2011-2013 Satoshi Egi | |
http://egison.pira.jp | |
Welcome to Egison Interpreter! | |
> (take 10 (match-all primes (list integer) [<join _ <cons $n <cons ,(+ n 2) _>>> [n (+ n 2)]])) | |
{[3 5] [5 7] [11 13] [17 19] [29 31] [41 43] [59 61] [71 73] [101 103] [107 109]} | |
> (take 10 (match-all primes (list integer) [<join _ <cons $n <cons ,(+ n 4) _>>> [n (+ n 4)]])) | |
{[7 11] [13 17] [19 23] [37 41] [43 47] [67 71] [79 83] [97 101] [103 107] [109 113]} | |
> (take 1 (match-all primes (list integer) [<join _ <cons $n <cons ,(+ n 2) <cons ,(+ n 4) _>>>> [n (+ n 2) (+ n 4)]])) | |
{[3 5 7]} | |
> (take 2 (match-all primes (list integer) [<join _ <cons $n <cons ,(+ n 2) <cons ,(+ n 4) _>>>> [n (+ n 2) (+ n 4)]])) | |
^C | |
/home/egi/egison3% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment