Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Binary-digits/NewLISP/binary-digits.l
Normal file
12
Task/Binary-digits/NewLISP/binary-digits.l
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
;;; Using the built-in "bits" function
|
||||
;;; For integers up to 9,223,372,036,854,775,807
|
||||
(map println (map bits '(0 5 50 9000)))
|
||||
;;; n > 0, "unlimited" size
|
||||
(define (big-bits n)
|
||||
(let (res "")
|
||||
(while (> n 0)
|
||||
(push (if (even? n) "0" "1") res)
|
||||
(setq n (/ n 2)))
|
||||
res))
|
||||
;;; Example
|
||||
(println (big-bits 1234567890123456789012345678901234567890L))
|
||||
Loading…
Add table
Add a link
Reference in a new issue