Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,30 @@
(import std.List)
(let self-exponent (fun (x n acc)
(if (> n 0)
(self-exponent x (- n 1) (* x acc))
acc)))
(let cache (list:map (list:iota 0 10) (fun (x) (if (= x 0) 0 (self-exponent x x 1)))))
(let is_munchausen (fun (number) {
(mut total 0)
(mut n number)
(mut continue true)
(while (and (> n 0) continue) {
(let digit (mod n 10))
(set total (+ total (@ cache digit)))
(if (> total number)
(set continue false)
(set n (math:floor (/ n 10)))) })
(= total number) }))
(let max_val 5000)
(mut i 1)
(while (< i max_val) {
(if (is_munchausen i)
(print i))
(set i (+ 1 i)) })