Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,37 @@
|
|||
#! /usr/local/bin/newlisp
|
||||
|
||||
(define (prime? n)
|
||||
(and
|
||||
(set 'lst (factor n))
|
||||
(= (length lst) 1)))
|
||||
|
||||
(define (thousands_separator i)
|
||||
(setq i (string i))
|
||||
(setq len (length i))
|
||||
(setq i (reverse (explode i)))
|
||||
(setq o "")
|
||||
(setq count3 0)
|
||||
(dolist (x i)
|
||||
(setq o (string o x))
|
||||
(inc count3)
|
||||
(if (and (= 3 count3) (< (+ $idx 1) len))
|
||||
(begin
|
||||
(setq o (string o "_"))
|
||||
(setq count3 0))))
|
||||
|
||||
(reverse o))
|
||||
|
||||
|
||||
;- - - Main begins here
|
||||
(setq i 42)
|
||||
(setq n 0)
|
||||
(while (< n 42)
|
||||
(if (prime? i)
|
||||
(begin
|
||||
(inc n)
|
||||
(println (string "n = " n " -> " (thousands_separator i)))
|
||||
(setq i (+ i i -1))))
|
||||
(inc i)
|
||||
)
|
||||
|
||||
(exit)
|
||||
Loading…
Add table
Add a link
Reference in a new issue