Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
36
Task/Casting-out-nines/PicoLisp/casting-out-nines.l
Normal file
36
Task/Casting-out-nines/PicoLisp/casting-out-nines.l
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
(de kaprekar (N)
|
||||
(let L (cons 0 (chop (* N N)))
|
||||
(for ((I . R) (cdr L) R (cdr R))
|
||||
(NIL (gt0 (format R)))
|
||||
(T (= N (+ @ (format (head I L)))) N) ) ) )
|
||||
|
||||
(de co9 (N)
|
||||
(until
|
||||
(> 9
|
||||
(setq N
|
||||
(sum
|
||||
'((N) (unless (= "9" N) (format N)))
|
||||
(chop N) ) ) ) )
|
||||
N )
|
||||
|
||||
(println 'Part1:)
|
||||
(println
|
||||
(=
|
||||
(co9 (+ 6395 1259))
|
||||
(co9 (+ (co9 6395) (co9 1259))) ) )
|
||||
|
||||
(println 'Part2:)
|
||||
(println
|
||||
(filter
|
||||
'((N) (= (co9 N) (co9 (* N N))))
|
||||
(range 1 100) ) )
|
||||
(println
|
||||
(filter kaprekar (range 1 100)) )
|
||||
|
||||
(println 'Part3 '- 'base17:)
|
||||
(println
|
||||
(filter
|
||||
'((N) (= (% N 16) (% (* N N) 16)))
|
||||
(range 1 100) ) )
|
||||
|
||||
(bye)
|
||||
Loading…
Add table
Add a link
Reference in a new issue