PYTHON--欧拉习题一

练习题来源:

https://projecteuler.net/archives

Problem 1:

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

问题1:

在10(不包括10)以内的自然数中,能够被3或5整除的数字有3、5、6、9,他们的和是23.

请找出1000以内(不包括1000),能被3或者5整除的自然数的和。

时间: 2024-08-07 08:38:44

PYTHON--欧拉习题一的相关文章

与项目欧拉速度比较:C vs Python与Erlang vs Haskell

我从问题#12 ProjectEuler作为编程练习,并比较我在C,Python,Erlang和Haskell中的实现(当然不是最优)实现.为了获得更高的执行时间,我搜索了第一个有1000个以上因子的三角形数字,而不是原始问题中所述的500个. 结果如下: <强> C: [email protected]:~/erlang$ gcc -lm -o euler12.bin euler12.c [email protected]:~/erlang$ time ./euler12.bin 84216

欧拉计划013(ProjectEuler013):求出10个数乘积最大的

申明:之前的所有欧拉计划都是用python来写的,的确python来写,代码量极少,学习起来也很方便.但是最近为了找java工作,所以用Java来完成欧拉计划的题,来复习一下Java. Large sum Problem 13 Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 371072875339021027987979982208375902465101357402

一站式打造你的智能语音产品欧拉蜜麦克风阵列板登陆众筹

2017年8月28日,OLAMI Microphone-Array Board:欧拉蜜麦克风阵列板正式开启众筹.据了解,该款麦克风阵列板可搭配主流开发板使用,迅速打造智能语音产品如智能音箱.声控车载设备等.目前正在聚丰众筹平台众筹,众筹早鸟价最低为299元. 性能强大:超远距离拾音,适配各种主板 (麦克风阵列板与其他硬件接线和应用的示意图) 欧拉蜜麦克风阵列板拥有4颗专业硅麦MEMS 麦克风,12 个 RGB LED以及1 个Power LED,4 个按键,USB 音频输入及麦克风输出(Micr

欧拉项目005:最小公倍数

Smallest multiple Problem 5 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? 就是找出1....20 所有数的最

欧拉计划003. 最大素因子

Problem 3: Largest prime factor The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? 求出最大素因子 我的python代码如下: num=600851475143 div=2 while div<=num: if num%div==0: num=num/div else: div=div+1 prin

欧拉项目004:寻找最大的回文数

Problem 4: Largest palindrome product A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. 寻找有两

006:欧拉项目平方和与和的平方的差

Sum square difference Problem 6 The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 Hence the difference between the sum of

欧拉工程第70题:Totient permutation

题目链接 和上面几题差不多的 Euler's Totient function, φ(n) [sometimes called the phi function]:小于等于n的数并且和n是互质的数的个数 存在这样的数:N的欧拉数φ(n),是N的一个排列 例如:φ(87109)=79180 求在1---10^7中n/φ(n) 取到最小的 n 是多少? 这里的是p是n的素因子,当素因子有相同的时候只取一个 任意一个正整数都能分解成若干个素数乘积的形式 直接利用上题的phi函数就可以求解 这个是跑的最

欧拉项目007:第10001个素数

10001st prime Problem 7 By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? 使用埃拉托斯特尼筛法,不懂得自行Wiki 我的python代码: # -*- coding:utf-8 -*- #使用埃拉托斯尼特晒法 #从2开始 import math def

通过欧拉计划学Rust(第1~6题)

最近想学习Libra数字货币的MOVE语言,发现它是用Rust编写的,看来想准确理解MOVE的机制,还需要对Rust有深刻的理解,所以开始了Rust的快速入门学习. 看了一下网上有关Rust的介绍,都说它的学习曲线相当陡峭,曾一度被其吓着,后来发现Rust借鉴了Haskell等函数式编程语言的优点,而我以前专门学习过Haskell,经过一段时间的入门学习,我现在已经喜欢上这门神奇的语言. 入门资料我用官方的<The Rust Programming Language>,非常权威,配合着<