Problem 34

145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.

Find the sum of all numbers which are equal to the sum of the factorial of their digits.

Note: as 1! = 1 and 2! = 2 are not sums they are not included.

puts (0..50000).select{|i|
i.to_s.length>1 && i == i.to_s.each_char.map{|d| (1..d.to_i).reduce(1,:*)}.reduce(:+)}.reduce(:+)

版权声明:本文博客原创文章,博客,未经同意,不得转载。

最新文章

  1. 【Go语言】连接数据库SQLite、MySQL、Oracle
  2. 在Mac中安装.Net Core的开发环境
  3. $(this) 和 this
  4. Week3(9月23日):例子更Powerful更完整了,哇咔咔
  5. 初识EPC
  6. java面试题整理(1)
  7. Python 小知识 杂七杂八 随手记
  8. SQL语句删除和添加外键、主键的方法
  9. 常用的16个c/c++面试题
  10. 【CV】ICCV2015_Unsupervised Visual Representation Learning by Context Prediction
  11. 关于PHP中的webshell
  12. TensorFlow的封装
  13. ie-table不显示边框解决办法
  14. swift笔记(二) —— 运算符
  15. python执行selenium报错
  16. SQL sqlserver order by 1,order by 后面直接加数字,多个字段排序
  17. 获取select值及判断是否是数字
  18. [SHOI2007]园丁的烦恼
  19. JAVA编程思想读书笔记(三)--RTTI
  20. vue-router在IE11中页面不跳转

热门文章

  1. MVC EF 增 删 改 查
  2. WPF下的视频录制界面设计
  3. C++习题 商品销售
  4. PHP如何添加内置的扩展
  5. 基于Spring + Spring MVC + Mybatis 高性能web构建
  6. pdf转换为word小工具,挺好
  7. 探索C/C++大数快(自然数)模板
  8. jQuery Mobile发展新闻阅读器,适应iphone和android打电话
  9. 鸟哥Linux私房菜知识汇总8至9章
  10. 系列三VisualSvn Server