Problem 34

https://projecteuler.net/problem=34

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

145是一个神奇的数字,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.

注意:不包括1和2。

def factorial(num):
f = 1
for i in range(1, num+1):
f *= i
return f tot = 0
nums = []
for i in range(3, 99999):
print(i)
digits = list(str(i))
if i < factorial(int(max(digits))):
continue
multi = 0
for digit in digits:
multi += factorial(int(digit))
if multi == i:
nums.append(i)
tot += i print(nums)
print(tot)

Problem 34的更多相关文章

  1. (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: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 ...

  3. projecteuler----&gt;problem=34----Digit factorials

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

  4. ●UOJ 34 多项式乘法

    题链: http://uoj.ac/problem/34 题解: FFT入门题. (终于接触到迷一样的FFT了) 初学者在对复数和单位根有简单了解的基础上,可以直接看<再探快速傅里叶变换> ...

  5. 【UOJ #34】多项式乘法

    http://uoj.ac/problem/34 看了好长时间的FFT和NTT啊qwq在原根那块磨蹭了好久_(:з」∠)_ 首先设答案多项式的长度拓展到2的幂次后为n,我们只要求出一个g(不是原根)满 ...

  6. 拆系数FFT

    学习内容:国家集训队2016论文 - 再谈快速傅里叶变换 模板题:http://uoj.ac/problem/34 1.基本介绍 对长度为L的\(A(x),B(x)\)进行DFT,可以利用 \[ \b ...

  7. 【uoj34】 多项式乘法

    http://uoj.ac/problem/34 (题目链接) 题意 求两个多项式的乘积 Solution 挂个FFT板子. 细节 FFT因为要满足$n$是$2$的幂,所以注意数组大小. 代码 // ...

  8. UOJ34 多项式乘法(非递归版)

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  9. 论文阅读 | A Survey on Multi-Task Learning

    摘要 多任务学习(Multi-Task Learning, MTL)是机器学习中的一种学习范式,其目的是利用包含在多个相关任务中的有用信息来帮助提高所有任务的泛化性能. 首先,我们将不同的MTL算法分 ...

随机推荐

  1. Flash--元件和实例

    1.元件简述: 元件在Flash影片中是一种特殊的对象.在Flash中仅仅须要创建一次,然后能够在整部电影中重复使用而不会显著添加 文件大小. 事实上在使用元件时,我们一般使用的是该元件的实例,所以说 ...

  2. 1732 Fibonacci数列 2

    1732 Fibonacci数列 2  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题解       题目描述 Description 在“1250 F ...

  3. Ubuntu 16.04 安装CodeBlocks

    首先将软件源添加进来,就是运行以下命令 sudo add-apt-repository ppa:damien-moore/codeblocks-stable sudo apt-get update 完 ...

  4. Fragmen的onAttach方法

    现在Android开发多使用一个Activity管理多个Fragment进行开发,不免需要两者相互传递数据,一般是给Fragment添加回调接口,让Activity继承并实现. 回调接口一般都写在Fr ...

  5. Changing the Output Path in your Web Applications is a bad idea

    http://lnbogen.com/2006/09/20/changing-the-output-path-in-your-web-applications-is-a-bad-idea/ Let’s ...

  6. ubuntu安装go语言

    1.下载安装包 2.解压 sudo tar -zvxf go1.10.linux-amd64.tar.gz -C /usr/local 3.配置 sudo vim /etc/profile 添加 #s ...

  7. 清北刷题班day3 morning

    P99zhx: 竞赛时间:???? 年?? 月?? 日??:??-??:??题目名称 a b c名称 a b c输入 a.in b.in c.in输出 a.out b.out c.out每个测试点时限 ...

  8. [Swift通天遁地]四、网络和线程-(7)检测服务器接口的访问状态:验证请求结果和可访问性

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  9. Ubuntu中安装部署Intel CS WebRTC

    1环境要求 组件 版本要求 OS CentOS* 7.4, Ubuntu 14.04/16.04 LTS Node 8.11.* (推荐8.11.1) MongoDB 2.4.9 Boost 1.65 ...

  10. Ansible+Jenkins+Gitlab搭建及配置

    Ansible+Jenkins+Gitlab搭建及配置,已经生产环境使用,运行良好. 主机组文件里面好多ip敏感信息就不写了