问题描述:
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that isevenly
divisibleby all of the numbers from 1 to 20?
即求1到20的所有数的最小公倍数。
解决方案:
(ns euler-problem-5.core
(:use clojure.contrib.math))
(defn smallest-lcm-from-1-to
[num]
(loop
[current-num 1 result 1]
(if (= current-num num)
(lcm result num)
(recur (inc current-num) (lcm current-num result)))))
(smallest-lcm-from-1-to 20)
运行结果:232792560
"Elapsed time: 0.301993 msecs"
分享到:
相关推荐
该存储库是使用Clojure解决Euler问题的支架。 它以有组织的结构生成规格和解决方案存根,从而使生活稍微好一些。 安装 如果尚未安装,则将其添加到您的路径中。 签出这个项目: $ git clone git@github....
Clojure骇客解决了Euler项目的问题。 目的是用惯用的Clojure编写功能解决方案。 用法 大多数解决方案都是完整的,并且完全独立地包含在具有“解决”功能的唯一名称空间中。 有些正在“进行中”。 执照 版权所有:...
欧拉计划 问题1-2、4、6、8-10、12、14、21、24-26、32、34、36、39、41、46、49、52、55-58、62、65的Clojure解决方案70-74、87、92、97、124、173-174、179、187、214运行解决方案使用以下命令行运行解决方案: ...
Clojure's clean, careful design lets you write programs that get right to the essence of a problem, without a lot of clutter and ceremony. Clojure is Lisp reloaded. Clojure has the power inherent in...
欧拉解决Clojure中的Euler项目问题的方法。 持续的爱好。执照版权所有:copyright:2012-2015 Dave Yarwood 在Eclipse Public License 1.0版下分发。
Clear, practical Clojure for the professional programmer Professional Clojure is the experienced developer's guide to functional programming using the Clojure language. Designed specifically to meet ...
在今后的软件设计中无论使用Clojure语言,还是坚持使用Java语言,Clojure语言都将与java做比较,哪种是设计软件的最佳方式。 Clojure语言是一个JVM(包括Groovy,Jython和JRuby等语言)的新语言,它提供了活力,...
Clojure is an opinionated language—it doesn’t try to cover all paradigms or provide every checklist bullet-point feature. Instead it provides the features needed to solve all kinds of real-world ...
Practical Clojure Clojure语言书籍
clojure clojure clojureclojure clojure
【1】[Clojure编程乐趣](The Joy of Clojure).pdf 【2】Clojure – Functional Programming for...【5】clojure Hand book(中文).pdf 【6】Clojure in Action.pdf 【7】clojure in small pieces.pdf 以上7本书的电子版
主要特性:从 Java 中保护你的 Clojure 程序,进行安全的互操作,正确的使用外部 Java 库。Typed Clojure 支持关键字映射的使用,类型检测器中包含有用的映射操作,包括关键字查找,添加或者移除关键字,合并映射...
[2013] Functional Programming Patterns in Scala and Clojure - Write Lean Programs for the JVM.(Michael Bevilacqua-Linn).[1937785475].pdf+epub.rar [2014] Clojure Cookbook - Recipes for Functional ...
Clojure编程乐趣和clojure_programming.pdf两本书
tools.analyzer, 用于Clojure代码的分析器,用Clojure编写,并在EDN中生成 AST tools.analyzer主机无关Clojure代码的分析器,用Clojure编写,并在EDN中生成 AST 。我在 2015年12月的ClojureX上讨论了 tools.analyzer...
Chapter 5. Composing Transducers Chapter 6. Exploring Category Theory Chapter 7. Programming with Logic Chapter 8. Leveraging Asynchronous Tasks Chapter 9. Reactive Programming Chapter 10. Testing ...
4clojure解决方案对问题的解决方案。 不是最惯用的 Clojure 代码,但到底是什么 - 它有效! :grinning_face:小费不要复制/粘贴解决方案,而是在理解所遵循的方法后尝试自己编写。 使用这些解决方案来找出算法而不是...
[2009] Programming Clojure.(Stuart Halloway).[1934356336].pdf [2010] Functional Programming with Clojure - Simple Concurrency on the JVM.(Tim Berglund, Matthew McCullough).[193650202X].pdf [2010] ...
clojure1.3.0及资料,附《Programming Clojure》,《Practical Clojure》