进阶之路

导航

2022年4月1日 #

一堆人中,其中两个人的生日是同一天的概率有多大呢?

摘要: “哇,你们两个同一天生日耶!” “你们居然是同一天生的,太幸运了吧!” 在我们的认知里,感觉两个人是同一天生日的概率非常低。 计算其实也很简单,不考虑闰年,一年有365天。其中一个人是365天里的一天,另一个要是同一天的话,就是1/365,0.274%的几率。 1/365 Out[2]: 0.002 阅读全文

posted @ 2022-04-01 11:41 中年小Q 阅读(1429) 评论(0) 推荐(0) 编辑

2018年4月27日 #

Problem 10: Summation of primes

摘要: def primeslist(max): ''' 求max值以内的质数序列 ''' a = [True]*(max+1) a[0],a[1]=False,False for index in range(2, len(a)): if a[index]==True: for i in range(index+i... 阅读全文

posted @ 2018-04-27 11:16 中年小Q 阅读(113) 评论(0) 推荐(0) 编辑

Problem 9: Special Pythagorean triplet

摘要: flag = 0 for a in range(1,1000): for b in range(a+1,1000): if a*a + b*b == (1000-a-b)**2: print(a,b) flag = 1 break if flag == 1: break pr... 阅读全文

posted @ 2018-04-27 11:12 中年小Q 阅读(106) 评论(0) 推荐(0) 编辑

Problem 7: 10001st prime

摘要: 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? 阅读全文

posted @ 2018-04-27 11:09 中年小Q 阅读(120) 评论(0) 推荐(0) 编辑

Problem 8: Largest product in a series

摘要: 先粘实现代码,以后需要再慢慢补充思路 阅读全文

posted @ 2018-04-27 11:05 中年小Q 阅读(151) 评论(0) 推荐(0) 编辑

2017年12月4日 #

Problem 5: Smallest multiple

摘要: 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 i 阅读全文

posted @ 2017-12-04 11:28 中年小Q 阅读(150) 评论(0) 推荐(0) 编辑

Problem 6: Sum square difference

摘要: 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 + 阅读全文

posted @ 2017-12-04 11:28 中年小Q 阅读(154) 评论(0) 推荐(0) 编辑

2017年11月28日 #

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 阅读全文

posted @ 2017-11-28 11:42 中年小Q 阅读(166) 评论(0) 推荐(0) 编辑

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 ? 欧拉题里很多是关于求质数,求质数的方法很多,我推荐的是筛选法,效率高,也很好理解 阅读全文

posted @ 2017-11-28 11:27 中年小Q 阅读(185) 评论(0) 推荐(0) 编辑

2017年11月27日 #

Problem 2: Even Fibonacci numbers

摘要: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 阅读全文

posted @ 2017-11-27 14:21 中年小Q 阅读(125) 评论(0) 推荐(0) 编辑