跳过正文
  1. Posts/

三角形数_百度百科

·876 字·2 分钟
目录

它有一定的规律性,排列如下(构成图),像上面的1、3、6、10、15等等这些能够表示成三角形的形状的总数量的数,叫做三角形数。

一定数目的点或圆在等距离的排列下可以形成一个等边三角形,这样的数被称为三角形数。比如10个点可以组成一个等边三角形,因此10是一个三角形数:

x

x x

x x x

x x x x

x x x x x

开始个18个三角形数是1、3、6、10、15、21、28、36、45、55、66、78、91、105、120、136、153、171……(OEIS中的数列A000217)

第n个三角形数的公式是

或者

第n个三角形数是开始的n个自然数的和。

所有大于3的三角形数都不是质数

开始的n个立方数的和是第n个三角形数的平方(举例:1 + 8 + 27 + 64 = 100 =102)

所有三角形数的倒数之和是2。

任何三角形数乘以8再加1是一个平方数

一部分三角形数(3、10、21、36、55、78……)可以用以下这个公式来表示:n × (2n + 1);而剩下的另一部分(1、6、15、28、45、66……)则可以用n × (2n - 1)来表示。

一种检验正整数x是否三角形数的方法,是计算:

如果n是整数,那么x就是第n个三角形数。如果n不是整数,那么x不是三角形数。这个检验法是基于恒等式8Tn + 1 = S2n + 1.

特殊的三角形数

55、5,050、500,500、50,005,000……都是三角形数。

第11个三角形数(66)、第1111个三角形数(617,716)、第111,111个三角形数(6,172,882,716)、第11,111,111个三角形数(61,728,399,382,716)都是回文式的三角形数,但第111个、第11,111个和第1,111,111个三角形数不是。

和其他数的关系

四面体数是三角形数在立体的推广。

两个相继的三角形数之和是平方数。

三角平方数是同时为三角形数和平方数的数。

三角形数属於一种多边形数

所有偶完美数都是三角形数。

任何自然数是最多三个三角形数的和。高斯发现了这个规律。他在1796年7月10日在日记中写道:EYPHKA! num = Δ + Δ + Δ

任意一个自然数最多只需要3个三角形数即可表示.


#

相关文章

hdu 2138 How many prime numbers

·517 字·2 分钟
ACM STEPS里的…这题前面一道是求LCM….结果接下来就是这么一道。。。 朴素会超….筛法会爆….题目顺序真是按照难度来的? 于是想到 Miller-Rabin素数测试……. 这个方法是基于费马小定理 我的理解就是… 如果我要判断n是否为素数 只要取k个数 如果满足 a^(n-1)mod n =1 那么n就很可能为素数。 证明什么的…暂时还是算了吧…论文里貌似扯了一大堆 第一次用,竟然真的A了。。。。 感觉更好的办法也许是先打一个比较小的素数表,然后每次random选取若干个进行判断…那样应该更可靠些? 本来想WA掉之后再改的。。。没想到这么写就A掉了。。。。杭电数据略水?

(BC 一周年)hdu 5310 Souvenir

·183 字·1 分钟
http://acm.hdu.edu.cn/showproblem.php?pid=5310 水。 不要用cin. Details 1 2 /************************************************************************* 3 > File Name: code/bc/#ann/1001.cpp 4 > Author: 111qqz 5 > Email: rkz2013@126.com 6 > Created Time: 2015年07月25日 星期六 18时54分24秒 7 ************************************************************************/ 8 9 #include<iostream> 10 #include<iomanip> 11 #include<cstdio> 12 #include<algorithm> 13 #include<cmath> 14 #include<cstring> 15 #include<string> 16 #include<map> 17 #include<set> 18 #include<queue> 19 #include<vector> 20 #include<stack> 21 #define y0 abc111qqz 22 #define y1 hust111qqz 23 #define yn hez111qqz 24 #define j1 cute111qqz 25 #define tm crazy111qqz 26 #define lr dying111qqz 27 using namespace std; 28 #define REP(i, n) for (int i=0;i<int(n);++i) 29 typedef long long LL; 30 typedef unsigned long long ULL; 31 int n,m,p,q; 32 int main() 33 { 34 int T; 35 cin>>T; 36 int ans = 0; 37 while (T--) 38 { 39 // scanf("%d %d %d %d",&n,&m,&p,&q); 40 scanf("%d %d %d %d",&n,&m,&p,&q); 41 ans = n*p; 42 ans = min(ans,n/m*q+n%m*p); 43 ans = min(ans,((n-1)/m+1)*q); 44 printf("%d\n",ans); 45 } 46 47 return 0; 48 }

uva 12442 . Forwarding Emails

·576 字·2 分钟
“… so forward this to ten other people, to prove that you believe the emperor has 题意是说发短信,每个人只会给一个人发,问从哪个人开始发,能传到的人最多

I - Fire Game (两个点开始的bfs)

·1296 字·3 分钟
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=83084#problem/I I - Fire Game **Time Limit:**1000MS **Memory Limit:**32768KB 64bit IO Format:%I64d & %I64u Submit Status Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstly they choose two grids which are consisting of grass and set fire. As we all know, the fire can spread among the grass. If the grid (x, y) is firing at time t, the grid which is adjacent to this grid will fire at time t+1 which refers to the grid (x+1, y), (x-1, y), (x, y+1), (x, y-1). This process ends when no new grid get fire. If then all the grid which are consisting of grass is get fired, Fat brother and Maze will stand in the middle of the grid and playing a MORE special (hentai) game. (Maybe it’s the OOXX game which decrypted in the last problem, who knows.)