(Problem 92)Square digit chains】的更多相关文章

A number chain is created by continuously adding the square of the digits in a number to form a new number until it has been seen before. For example, 44  32  13  10  1  1 85  89  145  42  20  4  16  37  58  89 Therefore any chain that arrives at 1 o…
A number chain is created by continuously adding the square of the digits in a number to form a new number until it has been seen before. For example, 44 → 32 → 13 → 10 → 1 → 1 85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89 Therefore any chain that…
题目 Square digit chains A number chain is created by continuously adding the square of the digits in a number to form a new number until it has been seen before. For example, 44 → 32 → 13 → 10 → 1 → 185 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89 The…
The number 145 is well known for the property that the sum of the factorial of its digits is equal to 145: 1! + 4! + 5! = 1 + 24 + 120 = 145 Perhaps less well known is 169, in that it produces the longest chain of numbers that link back to 169; it tu…
145 is a curious number, as 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. 题目大意: 145 是一个奇怪的数字, 因为 1! + 4! + 5!…
The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that49/98 = 4/8, which is correct, is obtained by cancelling the 9s. We shall consider fractions like, 30/50 = 3/5, to be…
The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number, 134217728=89, is a ninth power. How many n-digit positive integers exist which are also an nth power? 这种数字满足下面条件: 对于数位为x的数S=k^x 有 10^(x-1)<=k^x<=10^x-1 #include &quo…
我的做法就是暴力,1+...+n 用前n项和公式就行 1^2+2^2+....+n^2就暴力了 做完后在讨论版发现两个有趣的东西. 一个是 (1+2+3+...+n)^2=(1^3)+(2^3)+(3^3)+...+(n^3) 另一个是 1^2+2^2+....+n^2的公式以及推导. 假设f(n) = an3 + bn2 + cn + d 已知:f(0) = 0; f(1) = 1; f(2) = 5; f(3) = 14 然后带入解方程,得到a,b,c,d,再用归纳法证明其正确性. 证明过程…
快乐数 写一个算法来判断一个数是不是"快乐数". 一个数是不是快乐是这么定义的:对于一个正整数,每一次将该数替换为他每个位置上的数字的平方和,然后重复这个过程直到这个数变为1,或是无限循环但始终变不到1.如果可以变为1,那么这个数就是快乐数. 样例 19 就是一个快乐数. 1^2 + 9^2 = 82 8^2 + 2^2 = 68 6^2 + 8^2 = 100 1^2 + 0^2 + 0^2 = 1 解题定义最大循环次数方法 public class Solution { /** *…
Description  Problem B.Last Digit  Background Give you a integer number N (1<=n<=2*10100). Pleasecompute S=11+22+33+-+NN   Give the last digit of S to me. Input Input file consists of several Ns, each N a line. It is ended with N=0. Output For each…