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) = 1+2+3+4+6+8+12+24=60. Sigma of small numbers is easy to find but for large numbers it is very difficult to find in a straight forward way. But mathematicians have discovered a formula to find sigma. If the prime power decomposition of an integer is

Then we can write,

For some n the value of σ(n) is odd and for others it is even. Given a value n, you will have to find how many integers from 1 to n have even value of σ.

Input

Input starts with an integer T (≤ 100), denoting the number of test cases.

Each case starts with a line containing an integer n (1 ≤ n ≤ 1012).

Output

For each case, print the case number and the result.

Sample Input

4

3

10

100

1000

Sample Output

Case 1: 1

Case 2: 5

Case 3: 83

Case 4: 947

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 100005
#define eps 1e-8
#define pi acos(-1.0)
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,int>pli;
typedef pair<int,char> pic;
typedef pair<pair<int,string>,pii> ppp;
typedef unsigned long long ull;
const long long mod=;
/*#ifndef ONLINE_JUDGE
freopen("1.txt","r",stdin);
#endif */ int pow_mul(ll a,ll b){
int ans=;
while(b){
if(b&) ans=ans*a%;
b>>=;
a=a*a%;
}
return ans;
} int main(){
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
#endif
// std::ios::sync_with_stdio(false);
int t;
cin>>t;
for(int _=;_<=t;_++){
ll n;
cin>>n;
int ans=;
for(ll i=;i*i<=n;i++){
ans++;
if(i*i*<=n) ans++;
}
cout<<"Case "<<_<<": "<<n-ans<<endl;
}
}

Sigma Function (平方数与平方数*2的约数和是奇数)的更多相关文章

  1. C语言之一数三平方

    一数三平方 有这样一个六位数,它本身是一个整数的平方,其高三位和低三位也分别是一个整数的平方,如225625=475*475,225=15*15,625=25*25;统计所有符合该条件的六位数 源代码 ...

  2. Leetcode 1577 数的平方等于两数乘积的方法数

    Leetcode 1577 数的平方等于两数乘积的方法数 题目 给你两个整数数组 nums1 和 nums2 ,请你返回根据以下规则形成的三元组的数目(类型 1 和类型 2 ): 类型 1:三元组 ( ...

  3. Uva 11395 Sigma Function (因子和)

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=109329#problem/C   题目在文末 题意:1~n (n:1~1012)中,因子 ...

  4. LightOJ1336 Sigma Function(约数和为偶数的个数)

    Sigma Function Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit ...

  5. D - Sigma Function 1~n内有多少个约数和为偶数

    /** 题目:D - Sigma Function 链接:https://vjudge.net/contest/154246#problem/D 题意:求1~n内约数和为偶数的数的个数. 思路:一个数 ...

  6. LightOJ1336 Sigma Function —— 质因子分解、约数和为偶数

    题目链接:https://vjudge.net/problem/LightOJ-1336 1336 - Sigma Function    PDF (English) Statistics Forum ...

  7. Sigma Function 数学 因子求和

    Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma ...

  8. LightOJ - 1336 - Sigma Function(质数分解)

    链接: https://vjudge.net/problem/LightOJ-1336 题意: Sigma function is an interesting function in Number ...

  9. LightOJ 13361336 - Sigma Function (找规律 + 唯一分解定理)

    http://lightoj.com/volume_showproblem.php?problem=1336 Sigma Function Time Limit:2000MS     Memory L ...

随机推荐

  1. 选择、操作web元素-2

    11月3日 等待web元素的出现 例子:百度搜索松勤网,点击操作后不等待页面刷新,下面选择页面元素的时候,该元素还是未出现 sleep方案的弊病:固定的等待时间,导致测试用例执行时间很长 为什么cli ...

  2. 尚硅谷springboot学习13-配置的加载

    配置可以有很多不同的来源,也有不同的加载顺序,下面来具体的看一下 配置文件加载位置 spring boot 启动会扫描以下位置的application.properties或者application. ...

  3. DOTWeen 使用

    using UnityEngine; using System.Collections; using DG.Tweening; using UnityEngine.UI; public class T ...

  4. PHP面向对象(抽象类与抽象方法、接口的实现)

    一.抽象类与抽象方法 1,任何一个类,如果它里面至少有一个方法是被声明为抽象的,那么这个类就必须被声明为抽象的. 2,定义为抽象的类不能被实例化. 3, 被定义为抽象的方法只是声明了其调用方式(参数) ...

  5. springboot 项目 注意事项

    SpringBoot出现下列错误. Your ApplicationContext is unlikely to start due to a @ComponentScan of the defaul ...

  6. [Sphinx]全文索引Sphinx的使用配置

    -------------------------------------------------------------------------------------- 搜索分为两种: 1. 对结 ...

  7. jQuery图片延迟加载插件:jquery.lazyload

    ----------------------------------------------------------------------------------------------- clas ...

  8. Structs复习 Path问题

    Path问题相对复杂 主要是路劲问题 但结论很简单 就是统一使用绝对路径 jar包 web.xml <?xml version="1.0" encoding="UT ...

  9. EF 踩过的坑

    ef + mysql-8.0.12-winx64 这个版本的mysql,当一个类为树型结构,会迁移报错. 数据迁移提示:No connection string named 'TaoBaoEntiti ...

  10. google image

    google图片抓取 google图片是base64加密的,而且base64后的信息放在script信息里面 import pymysql from lxml import etree import ...