一个让人脑洞大开的题. 题目大意比较简单,询问[1,n]有多少个数其因子和为偶数. 因子分解定理中求因子和的公式是 f(n)=(1+p1+p1^2+p1^3+...+p1^a1)(1+p2+p2^2+...+p2^a2).... 如果让因子和为偶数,首先我们看一下两个数相乘怎么才能得到偶数: 1 even*even=even 2 even*odd  =even 3 odd*even  =even. 会有三种情况,但是如果要得到奇数只需要odd*odd=odd,所以我们不妨求因子和为奇数的情况.…
题意: 求1-n中约数和为偶数的数的个数 记住一个定理:...平方数 及其 平方数的2倍 的约数和为奇数  then....减啦 证明: ....我jiao着人家写的很详细,so 看看人家写的吧! 转载至:https://blog.csdn.net/Rain722/article/details/64439310 数x的因子和 f(x)= (1+p1+p1^2+p1^3+...+p1^a1)*(1+p2+p2^2+...+p2^a2)*...*(1+pn+pn^2+...+pn^an); 因为偶…
Sigma Function (LightOJ - 1336)[简单数论][算术基本定理][思维] 标签: 入门讲座题解 数论 题目描述 Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For exam…
Pairs Forming LCM (LightOJ - 1236)[简单数论][质因数分解][算术基本定理](未完成) 标签: 入门讲座题解 数论 题目描述 Find the result of the following code: long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for( int j = i; j <= n; j++ ) if( lcm(i, j) ==…
Aladdin and the Flying Carpet (LightOJ - 1341)[简单数论][算术基本定理][分解质因数](未完成) 标签:入门讲座题解 数论 题目描述 It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first myste…
链接: https://vjudge.net/problem/LightOJ-1336 题意: Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24) = 1+2+3+4+6…
http://lightoj.com/volume_showproblem.php?problem=1336 Sigma Function Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1336 Description Sigma function is an interesting function in Number Theor…
[LightOJ1336]Sigma Function(数论) 题面 Vjudge 求和运算是一种有趣的操作,它来源于古希腊字母σ,现在我们来求一个数字的所有因子之和.例如σ(24)=1+2+3+4+6+8+12+24=60.对于小的数字求和是非常的简单,但是对于大数字求和就比较困难了.现在给你一个n,你需要求出有多少个数字的σ是偶数. 注:一个数字的σ指这个数的所有因子之和 题解 现在观察一下数的因子和的奇偶性 如果这个数是一个奇数 那么,它的因子一定成对存在 且每一对的和都是偶数 但是,如果…
1336 - Sigma Function   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all…
Help Hanzo (LightOJ - 1197) [简单数论][筛区间质数] 标签: 入门讲座题解 数论 题目描述 Amakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason behind this is he had a little problem with Hanzo Hattori, the best ninja and the love of Nakurur…
Goldbach`s Conjecture(LightOJ - 1259)[简单数论][筛法] 标签: 入门讲座题解 数论 题目描述 Goldbach's conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states: Every even integer, greater than 2, can be expressed as the sum of…
题意: 就是求a的因数中大于b的有几对 解析: 先把素数打表 运用算术基本定理 求出a的所有因数的个数 然后减去小于b的因数的个数 代码如下: #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <vector> #include <stac…
题意: 就是....求a的所有大于b的因子有多少对 算术基本定理求 所有因子 阿欧...偷张图. 注意范围 就好  ..... 解析: 在1 -1012的范围内求大于b的所有a的因子的对数(有几对) 就等于 在1 -1012的范围内求出a的所有因子 除二  减去  在1 - (b-1)的范围内a的所有因子 #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #in…
Sigma Function Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1336 Description Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This fu…
[整除] 若a被b整除,即a是b的倍数,那么记作b|a("|"是整除符号),读作"b整除a"或"a能被b整除".b叫做a的约数(或因数),a叫做b的倍数. [质因数分解] 把一个正整数数分解成几个质数的幂相乘的形式叫做质因数分解. e.g. 10=2*5 16=24 18=2*32 [唯一分解定理] 唯一分解定理(算术基本定理)可表述为:任何一个大于1的自然数 N,如果N不为质数,那么N可以唯一分解成有限个质数的乘积: N=P1a1*P2a2*P…
题目链接:https://vjudge.net/problem/LightOJ-1336 1336 - Sigma Function    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ).…
You are given an array aa consisting of nn integers. Your task is to say the number of such positive integers xx such that xx divides eachnumber from the array. In other words, you have to find the number of common divisors of all elements in the arr…
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=109329#problem/C   题目在文末 题意:1~n (n:1~1012)中,因子和为偶数的有几个.题解: 因子和 Sum=(p1^0+p1^1….p1^e1)*(p2^0+p2^1…p2^e2)……(pn^0+…pn^en); = (p1^0+p1^1….p1^e1),(p2^0+p2^1…p2^e2),……(pn^0+…pn^en)中只要有一个是偶数,因子和sum就为偶数.所…
堆栈种分配的局部变量所谓的“标号”,你以为是什么?(都是那些该死的宏惹的祸,大家要都是老老实实写代码,就不会有这些疑问了).      比如你用local在栈上定义了一个局部变量LocalVar,你知道实际的指令是什么么?一般都差不多像下面的样子:      push    ebp      mov    esp,    ebp      sub    esp,    4      现在栈上就有了4各字节的空间,这就是你的局部变量.      接下来,你执行mov    LocalVar,   …
题目大意:输入一个整数n,输出使2^x mod n = 1成立的最小值K 解题思路:简单数论 1)n可能不能为偶数.因为偶数可不可能模上偶数以后==1. 2)n肯定不可能为1 .因为任何数模上1 == 0: 3)所以n肯定是除1外的奇数 代码如下: #include <iostream> using namespace std; int main(){ int n; while(scanf("%d",&n)!=EOF){ if(n == 1 || n % 2 ==…
Sigma Function https://vjudge.net/contest/288520#problem/D Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24)…
传送门 简单数论暴力题. 题目简述:要求求出所有满足x2≡1mod&ThinSpace;&ThinSpace;nx^2\equiv1 \mod nx2≡1modn且0≤x<n0\le x<n0≤x<n的xxx 考虑到使用平方差公式变形. (x−1)(x+1)≡0mod&ThinSpace;&ThinSpace;n(x-1)(x+1)\equiv0 \mod n(x−1)(x+1)≡0modn 即(x−1)(x+1)=kn(x-1)(x+1)=kn(x−1)…
/** 题目:D - Sigma Function 链接:https://vjudge.net/contest/154246#problem/D 题意:求1~n内约数和为偶数的数的个数. 思路:一个数的约数和为那个数的每个素因子的等比和相乘.如题目所给公式就是等比和化简之后的式子. 那么要判断一个数约数和是否为偶数,可以通过观察它的各个素因子等比和来判断.如果存在某个素因子的等比和为偶数. 那么这个约数和肯定是偶数.否则为奇数. 素因子只有2是偶数,其他都是奇素数. 含素因子2的等比和一定为奇数…
www.51nod.com/onlineJudge/questionCode.html#!problemId=1189 1189 阶乘分数 题目来源: Spoj 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 1/N! = 1/X + 1/Y(0<x<=y),给出N,求满足条件的整数解的数量.例如:N = 2,1/2 = 1/3 + 1/6,1/2 = 1/4 + 1/4.由于数量可能很大,输出Mod 10^9 + 7.   Input 输入一个…
Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24) = 1+2+3+4+6+8+12+24=60. Sigma of small numbers is easy to f…
Least Common Multiple (HDU - 1019) [简单数论][LCM][欧几里得辗转相除法] 标签: 入门讲座题解 数论 题目描述 The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7…
七夕节 (HDU - 1215) [简单数论][找因数] 标签: 入门讲座题解 数论 题目描述 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!" 人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下: 数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2,3,4,6. 你想知道你的另一半吗? Input 输入数据的第一行是一个数字T(1<=T<=500000)…
题目大意 给定一个三元组\((x,y,z)\)的\(gcd\)和\(lcm\),求可能的三元组的数量是多少,其中三元组是的具有顺序的 其中\(gcd\)和\(lcm\)都是32位整数范围之内 由算术基本定理可以得知: 如果$k=gcd(m,n) \(则\) k_p=min(m_p,n_p)$ 如果\(k=lcm(m,n)\)则\(k_p=max(m_p,n_p)\) 那么我们可以把每个质因数分开讨论,因为三元组是有序的,所以我们考虑每两个数成为gcd和lcm的,另一个数在\((p_gcd,p_l…
原文地址:https://blog.csdn.net/qq_37632935/article/details/79465213 给你一个数n(n<=10^14),然后问n能用几个连续的数表示; 求出sum奇因子的个数 就是答案  用算术基本定理的代码求就好了  vis设置为bool的 要不会翻车.. 答案要减一 因为1不是奇数 #include <iostream> #include <cstdio> #include <sstream> #include <…
题目大意:f(n)为n的因子和,给出 n 求 1~n 中f(n)为偶数的个数. 题目思路:算数基本定理: n=p1^e1*p2^e1 …… pn^en (p为素数): f(n)=(1+p1+p1^2+p^3……+p^e1)*(1+p2+p2^2……+p2^e2)……*(1+pn+pn^2……+pn^en). 偶数个个奇数相乘仍为奇数,奇数个奇数相乘则为偶数,为了使f(n)为奇数,那么多项式中的每一项都应为奇数. 对于每个多项式内:偶数个奇数相加为偶数,奇数个奇数相加为奇数,为了使多项式为奇数,那…