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. android kl 文件的作用【转】

    本文转载自:http://blog.csdn.net/u013308744/article/details/49274069 首先看touchscreen的kl文件 # Copyright (c) 2 ...

  2. Vue相关开源项目库汇总 http://www.opendigg.com/tags/front-vue

    awesome-github-vue 是由OpenDigg整理并维护的Vue相关开源项目库集合.我们会定期同步OpenDigg上的项目到这里,也欢迎各位提交项目给我们. 如果收录的项目有错误,可以通过 ...

  3. 【POJ 2503】 Babelfish

    [题目链接] http://poj.org/problem?id=2503 [算法] 字符串哈希 [代码] #include <algorithm> #include <bitset ...

  4. cloudstack ---部署的架构

    cloudstack跟KVM一起部署的架构 下图是CloudStack跟kvm一起部署的架构: 在每个kvm的宿主机上都需要部署agent程序. cloudstack跟vsphere一起部署的架构 下 ...

  5. 判断人员js

    var allchooseEmpID = "";var allchooseEmpName = "";//自选经办人 function getJbrWinForM ...

  6. 【Codeforces1117C_CF1117C】Magic Ship(构造)

    题目: Codeforces1117C 考的时候很困,开局半小时后才过A,只做出来AB,排名3000+,掉了119--半夜体验极差. 翻译: 你是一个船长.最初你在点 \((x_1,y_1)\) (显 ...

  7. js的toFixed解惑

    js中的toFixed,C#中的Math.round都是按照银行家算法的定义来算的,这里只拿js作参考,各个浏览器的计算方式并不一样,先看一张图,对比参数很容易就发现了其中的不同之处: 前三个Chro ...

  8. Laravel (5.5.33) 加载过程---make方法(四)

    /** * Resolve the given type from the container. * * @param string $abstract * @return mixed */ publ ...

  9. 亚马逊EC2构建代理服务器心血历程

    1.亚马逊上申请一台免费的EC2服务器,有相应的教程,绑定信用卡,预支付1美元,据说可以退回(防止到期后直接扣款,支付后通过修改卡信息,但好象有提示了,说卡不对了,也不管它了,到期后再说,美国人也不是 ...

  10. [Windows Server 2003] 安装网站伪静态

    ★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频.★ 本节我们将带领大家:安装IIS伪静 ...