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. ASP.NET 4 and Visual Studio 2010

    https://msdn.microsoft.com/en-us/library/ee532866.aspx The topics in this section provide informatio ...

  2. Bing Maps进阶系列六:使用Silverlight剪切(Clip)特性实现Bing Maps的迷你小地图

    Bing Maps进阶系列六:使用Silverlight剪切(Clip)特性实现Bing Maps的迷你小地图 Bing Maps Silverlight Control虽然为我们提供了简洁.方面的开 ...

  3. 【Poj2960】S-Nim & 博弈论

    Position: http://poj.org/problem?id=2960 List Poj2960 S-Nim List Description Knowledge Solution Noti ...

  4. influxdb入门——和mongodb一样可以动态增加字段

    ./influxd [--config yourconfigfile 2> /dev/null]  之所以重定向 因为默认log是stderr 再启动客户端./influx > CREAT ...

  5. hdu 4123(树形dp+倍增)

    Bob’s Race Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  6. 【POJ 1716】 Integer Intervals

    [题目链接] 点击打开链接 [算法] 差分约束系统 [代码] #include <algorithm> #include <bitset> #include <cctyp ...

  7. POJ 3268 最短路应用

    POJ3268 题意很简单 正向图跑一遍SPFA 反向图再跑一边SPFA 找最大值即可. #include<iostream> #include<cstdio> #includ ...

  8. 杂项:LDAP

    ylbtech-杂项:LDAP 1.返回顶部 1. LDAP是轻量目录访问协议,英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP.它是基于X. ...

  9. Linux基本命令 文件管理 下部

    1.1 移动文件 将/data目录移动到/root下 涉及命令mv [root@oldboyedu-50 ~]# mv /data/ /root/ 移动 [root@oldboyedu-50 ~]# ...

  10. 洛谷P1182数列分段

    题目描述 对于给定的一个长度为N的正整数数列A[i],现要将其分成M(M≤N)段,并要求每段连续,且每段和的最大值最小. 关于最大值最小: 例如一数列4 2 4 5 1要分成3段 将其如下分段: [4 ...