10 2018 档案
摘要:题目: A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each
阅读全文
摘要:题目: Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known sys
阅读全文
摘要:题目: "Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says. "The second problem is, given an pos
阅读全文
摘要:题目: 假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值<=50的单词呢?单词的价值就是组成一个单词的所有字母的价值之和,比如,单词ACM的价值是1+3+14=18,单词
阅读全文
摘要:题目: Longge is good at mathematics and he likes to think about hard mathematical problems which will be solved by some graceful algorithms. Now a probl
阅读全文
摘要:一、题目 Chinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own lucky number L. Now he wants to construct his
阅读全文
摘要:一、题目 A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from the origin
阅读全文
摘要:一、题目 The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 < a < b <= n and gcd(a,b) = 1 arranged
阅读全文
摘要:一、题目 We say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set { (x i mod p) | 1 <= i <= p-1 } is equal to { 1,
阅读全文
摘要:一、题目 Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there
阅读全文
摘要:一、引文 1.欧拉函数:指不超过n且与n互素的正整数的个数,其中,n是一个正整数。 二、相关知识 1.算数函数:定义在所有正整数上的函数称为算数函数。 2.乘性函数(积性函数):对算数函数ƒ 如果满足对任意两个互素的正整数n和m,均有ƒ(nm)=ƒ(n)ƒ(m)。 3.完全乘性函数(完全积性函数):
阅读全文
摘要:引文:如果要对比较大的整数分解,显然之前所学的筛选法和是试除法都将不再适用。所以我们需要学习速度更快的Pollard_Rho算法。 算法原理: 生成两个整数a和b,计算p=gcd(a-b, n),知道p不为1或a,b出现循环为止,若p=n,则n为质数,否则p为n的一个约数。 对于如何生成这两个数,选
阅读全文
摘要:定义:给出一个正整数,将其携程几个素数的乘积,这个过程称为整数分解。 例题:HDU_1164 https://vjudge.net/problem/HDU-1164 一、试除法 算法:令m = n,从2~sqrt(N) 一一枚举,如果当前数能够整除m,那么当前数就是n的素因子,并用整数m将当前数除尽
阅读全文
摘要:引语:在数论中,对于素数的研究一直就很多,素数测试的方法也是非常多,如埃式筛法,6N±1法,或者直接暴力判(试除法)。但是如果要判断比较大的数是否为素数,那么传统的试除法和筛法都不再适用。所以我们需要学习Miller_Rabin算法。 知识准备 + 算法推导: 1.威尔逊定理:若p是素数,则 (p-
阅读全文