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. Tomcat 配置Https

    https://www.cnblogs.com/wanghaoyuhappy/p/5267702.html JDK1.8 keytool 生存证书 C:\keys\tomcat.keystore 1: ...

  2. struts2默认临时文件更改

    struts的文件上传mutifile会有一个临时文件地址,如果需要使用自己指定临时文件地址需要在struts.xml中设置以下内容. <constant name="struts.m ...

  3. iOS app bundle id

    每个app的bundle id是唯一的,不同开发者账号不能申请相同的bundle id,例如开发者账号B想用开发者A的bundle id,只能是开发者A将这个bundle id先删除,B才可以注册,否 ...

  4. mongo aggregate 用法记录

    mongo 聚合查询查询还是很方便的,做下记录     依赖的jar是org.springframework.data.mongodb 1.9.6  低版本可能不支持. 数据结构  大概是  这是一份 ...

  5. ACM__01背包,完全背包,多重背包

    今天写题的时候碰到了一道完全背包题,可是没有看出来,乱写了一通,浪费了一个晚上,顺便复习一下背包的知识 01背包 每种物品只能选择一次或者不选,求背包容量内的最大价值 先给出状态转移方程: f[i][ ...

  6. 如何查看虚拟机的ip地址,以及如何给虚拟机配置静态ip

    1 在命令行上敲ifconfig 如下图: 通过inet addr : 192.168.25.129就是你的虚拟机当前的ip 2. 我们一般在局域网内是通过dhcp协议向网关发送ip请求,因此获取的i ...

  7. 剑指offer例题——二维数组中的查找

    //实现一个函数,将一个字符串的每个空格替换成“%20”.例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy. public class Solutio ...

  8. 使用xshell xftp连接centos的过程。

    1 配置网络 登录Centtos系统,配置网卡. cd 空格/etc/sysconfig/network-scripts  回车键. ls 查看文件 vi ifcig-eth0  编辑这个文件 修改为 ...

  9. 【原创】思科和锐捷组建多VLAN交换网络(隧道模式Trunk)

    组建简单交换网络设计与实施 [利用思科仿真与锐捷实践] 本文目录 第一部分 预备知识 第二部分 设计与仿真 需求分析 整体设计 PT仿真 第三部分 施工部署 console配置 连通测试 第一部分 预 ...

  10. 制作基于U盘启动和网络常识

    一.制作基于U盘启动的操作系统盘1.准备相关的软件和硬件 下载软件并安装到[电脑]中 ——大白菜.老毛桃 硬件——U盘(空的) 2.插入U盘,点击桌面上的[大白菜装机版]打开大白菜, 点击[一键制作U ...