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(:+)

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

projecteuler---->problem=34----Digit factorials的更多相关文章

  1. Project Euler:Problem 34 Digit factorials

    145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are ...

  2. Project Euler 34 Digit factorials

    题意:判断一个数 N 的各个位数阶乘之和是否为其本身,找出所有符合要求的数然后求和 思路:此题思路跟 30 题相同,找到枚举上界 10 ^ n <= 9! × n ,符合要求的 n < 6 ...

  3. Problem 34

    Problem 34 https://projecteuler.net/problem=34 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 1 ...

  4. (Problem 34)Digit factorials

    145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find the sum of all numbers which are ...

  5. TJU Problem 2857 Digit Sorting

    原题: 2857.   Digit Sorting Time Limit: 1.0 Seconds   Memory Limit: 65536KTotal Runs: 3234   Accepted ...

  6. Project Euler:Problem 33 Digit cancelling fractions

    The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplif ...

  7. Project Euler Problem 16-Power digit sum

    直接python搞过.没啥好办法.看了下别人做的,多数也是大数乘法搞过. 如果用大数做的话,c++写的话,fft优化大数乘法,然后快速幂一下就好了.

  8. Problem 30

    Problem 30 https://projecteuler.net/problem=30 Surprisingly there are only three numbers that can be ...

  9. Problem 63

    Problem 63 https://projecteuler.net/problem=63 Powerful digit counts The 5-digit number, 16807=75, i ...

随机推荐

  1. Enum变量值的Discretion

    有些时候,某个方法的返回值是个枚举类型,比如描述登录结果: public enum LoginResult { Success, WrongPassword, } 当前段UI获取到登陆方法的返回结果时 ...

  2. 【原创】leetCodeOj ---Remove Duplicates from Sorted List II 解题报告

    明日深圳行,心情紧张,写博文压压惊 囧 ------------------------------------- 原题地址: https://oj.leetcode.com/problems/rem ...

  3. Windows下Git服务器搭建[转]

    Windows下Git服务器搭建   作为对前两天Git服务器搭建的一个整理,我想分别从服务端和客户端两个角度来记录下整个搭建过程,为了达到目标,我们需要哪些操作. (一)服务端软件和账号的安装配置 ...

  4. C#取硬盘、CPU、主板、网卡的序号 ManagementObjectSearcher

    原文:C#取硬盘.CPU.主板.网卡的序号 ManagementObjectSearcher private void button1_Click(object sender, EventArgs e ...

  5. Spring HTTPInvoker原理猜想(HTTP+序列化)

    没有查看源码,仅作参考 实现步骤: 一,客户端 (1),远程调用信息封装为远程调用对象 (2),序列化写入到远程调用HTTP请求中 (3),向服务器发送 (4),服务器端返回的HTTP响应结果 (5) ...

  6. 玩转Web之easyui(三)-----easy ui dataGird 重新指定url以获取不同数据源信息

    如果已经写了一个dataGird并且已经通过url绑定数据源,能不能在其他地方改变url使其从不同数据源获取信息,从而实现查询等操作?答案当然是肯定的,而且仅需要几行代码 $('#btnq').bin ...

  7. PHPthinking官方论坛

    PHPthinking官方论坛正式上线一个月!眼下.我们已经有数百个固定用户的.论坛发展迅速,所有份额一些技术贴,我们希望,其他许多用户增加来,创建学习.交流更方便.丰富的内容PHP座谈会! PHPt ...

  8. Directx11学习笔记【五】 基本的数学知识----向量篇

    本文参考dx11龙书 Chapter1 vector algebra(向量代数) 要想学好游戏编程,扎实的数学知识是尤为重要的,下面将对dx11龙书中有关向量的数学知识做一下总结. 在数学中,几何向量 ...

  9. Hibernate 学习教程

    第1课 课程内容. 6 第2课Hibernate UML图. 6 第3课 风格. 7 第4课 资源. 7 第5课 环境准备. 7 第6课 第一个演示样例HibernateHelloWorld 7 第7 ...

  10. 可以改变文本行距(行间距)的Label

    ////////////////////////////////////////////////////// /// ///功能:可以改变文本行距(行间距)的Label ///作者:emanlee / ...