projecteuler---->problem=34----Digit factorials
2024-08-21 02:06:38
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(:+)
版权声明:本文博客原创文章,博客,未经同意,不得转载。
最新文章
- 【Go语言】连接数据库SQLite、MySQL、Oracle
- 在Mac中安装.Net Core的开发环境
- $(this) 和 this
- Week3(9月23日):例子更Powerful更完整了,哇咔咔
- 初识EPC
- java面试题整理(1)
- Python 小知识 杂七杂八 随手记
- SQL语句删除和添加外键、主键的方法
- 常用的16个c/c++面试题
- 【CV】ICCV2015_Unsupervised Visual Representation Learning by Context Prediction
- 关于PHP中的webshell
- TensorFlow的封装
- ie-table不显示边框解决办法
- swift笔记(二) —— 运算符
- python执行selenium报错
- SQL sqlserver order by 1,order by 后面直接加数字,多个字段排序
- 获取select值及判断是否是数字
- [SHOI2007]园丁的烦恼
- JAVA编程思想读书笔记(三)--RTTI
- vue-router在IE11中页面不跳转