---
title: "初学编程的必做数学题目"
author: "rensanning"
date: "2017-08-11T13:06:09Z"
tags: []
categories: ["非技术"]
slug: "untitled"
draft: false
lastmod: "2017-08-21T08:16:05Z"
id: 2389339
url: "https://rensanning.iteye.com/blog/2389339"
---

初学编程时，这些一定是<span style="color:red">**必做**</span>的数学题目！

**（1） 数字**

<span style="color:red">奇数（Odd）偶数（Even）</span>
奇数就是不能被2整除的整数。偶数就是能被2整除的整数。

<span style="color:red">闰年（Leap year）</span>
能被4整除但不能被100整除，或能被400整除的年份即为闰年。

<span style="color:red">质数（Prime Number）</span> 也叫素数，除了1和本身以外不再有其他因数的整数。如:2、3、5、7、11、13、17、19
https://en.wikipedia.org/wiki/Prime_number
http://mathworld.wolfram.com/PrimeNumber.html

<span style="color:red">合数（Composite number）</span> 与质数相反，除了能被1和本身整除外，还能被其他数整除的数。如:4、6、8、9、10
https://en.wikipedia.org/wiki/Composite_number
http://mathworld.wolfram.com/CompositeNumber.html

<span style="color:red">完美数（Perfect number）</span> 一个数恰好等于它的因子之和。如:6=1+2+3
https://en.wikipedia.org/wiki/Perfect_number
http://mathworld.wolfram.com/PerfectNumber.html

<span style="color:red">亲和数(Amicable number)</span> 如果两个数,你的所有真因数之和等于我,我的所有真因数之和等于你,则我们是一对亲和数。如:(220, 284), (1184, 1210)
https://en.wikipedia.org/wiki/Amicable_numbers
http://mathworld.wolfram.com/AmicablePair.html

<span style="color:red">回文数（Palindrome number）</span> 一个数正读和反读是相同的整数。如:16461
https://en.wikipedia.org/wiki/Palindromic_number
http://mathworld.wolfram.com/PalindromicNumber.html

<span style="color:red">水仙花数（Narcissistic number） </span>一个三位数等于每个数字的n次幂之和。如:153=1^3+5^3+3^3。水仙花数共有4个，分别为：153、370、371、407。
<span style="color:red">阿姆斯特朗数（Armstrong number）</span> 比水仙花数范围大，不局限于三位数。
https://en.wikipedia.org/wiki/Narcissistic_number
http://mathworld.wolfram.com/NarcissisticNumber.html

<span style="color:red">斐波那契数列（Fibonacci number）</span> 每一个数都是它前面两个数的和。 F(n)=F(n-1)+F(n-2) 具体数列为:1,1,2,3,5,8,13,21,34,55,89,144,...
<span style="color:red">泰波那契数列（Tribonacci number）</span> 把斐波那契数列的概念推广至三个数。 T(n)=T(n-1)+T(n-2)+T(n-3)
https://en.wikipedia.org/wiki/Fibonacci_number
http://mathworld.wolfram.com/FibonacciNumber.html

<span style="color:red">勾股数（Pythagorean Triple）</span> a^2+b^2=c^2
https://en.wikipedia.org/wiki/Pythagorean_triple
http://mathworld.wolfram.com/PythagoreanTriple.html

<span style="color:red">π</span> PI=4*(1-1/3+1/5-1/7+1/9-1/11+1/13-1/15+...)
https://en.wikipedia.org/wiki/Pi
http://mathworld.wolfram.com/Pi.html

<span style="color:red">调和级数(Harmonic series) </span>H(n)=1+1/2+1/3+1/4+...+1/n
https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)
http://mathworld.wolfram.com/HarmonicSeries.html

**（2） 运算**

<span style="color:red">求和（Sum）</span> 1+2+3+...+n
https://en.wikipedia.org/wiki/Summation
http://mathworld.wolfram.com/Sum.html

<span style="color:red">阶乘（Factorial）</span> n!=n*(n-1)...2*1
https://en.wikipedia.org/wiki/Factorial
http://mathworld.wolfram.com/Factorial.html

<span style="color:red">约数（Factor/Divisor）</span>
https://en.wikipedia.org/wiki/Divisor
http://mathworld.wolfram.com/Divisor.html

<span style="color:red">最大公约数（GCD：Greatest Common Divisor）</span>
https://en.wikipedia.org/wiki/Greatest_common_divisor
http://mathworld.wolfram.com/GreatestCommonDivisor.html

<span style="color:red">最小公倍数（LCM：Lowest Common Multipl）</span>
https://en.wikipedia.org/wiki/Least_common_multiple
http://mathworld.wolfram.com/LeastCommonMultiple.html

**（3） 打印图形**

<span style="color:red">金字塔Pyramid、菱形Diamond</span>
![](http://dl2.iteye.com/upload/attachment/0126/4844/1dca8831-717e-3e00-838e-299ca0699cea.png)

<span style="color:red">箭头</span>
![](http://dl2.iteye.com/upload/attachment/0126/4846/6866cec8-c895-333b-9fd6-a1ced83fbf8c.png)

<span style="color:red">其他形状</span>
![](http://dl2.iteye.com/upload/attachment/0126/4848/d5b829eb-cd8b-3684-8973-77930edeec58.png)

<span style="color:red">帕斯卡三角（Pascal Triangle）</span> 也叫杨辉三角
![](http://dl2.iteye.com/upload/attachment/0126/4850/d596efa2-9d60-3eb4-8e11-069443ddc9eb.png)

<span style="color:red">九九乘法表（Multiplication Table）</span>
![](http://dl2.iteye.com/upload/attachment/0126/4852/65bacdb3-df29-3bff-ae96-dbb4e569637f.png)
![](http://dl2.iteye.com/upload/attachment/0126/4854/713c36e7-d3e2-3b32-b4ac-732272eba669.png)

**（4） 汉诺塔（Hanoi Tower）**

有A、B和C 3跟柱子，在A上从下往上按照从小到大的顺序放着64个圆盘，以B为中介，把盘子全部移动到C上。移动过程中，要求任意盘子的下面要么没有盘子，要么只能有比它大的盘子。

https://en.wikipedia.org/wiki/Tower_of_Hanoi