F - Sigma Function

本文介绍了数论中有趣的Sigma函数,该函数表示一个数的所有除数之和,并提供了一个计算公式。文章还给出了一段C++代码,用于计算1到n之间具有偶数Sigma值的整数数量。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 <cstring>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#define MAXN 1e7+5
using namespace std;
typedef long long LL;

int main()
{
    int T;
	LL n;
	scanf("%d",&T);
    while(T--)
	{
		int cas=1;
		scanf("%lld",&n);
		LL num1,num2;
		num1=(LL)sqrt((double)n);
		num2=(LL)sqrt((double)n/2.0);
        printf("Case %d: %lld\n",cas++,n-num1-num2);
	}
	return 0;
}

 

### 连续时间Sigma-Delta调制器在MATLAB中的实现 #### 创建连续时间Sigma-Delta调制器模型 为了创建一个连续时间Sigma-Delta (CTSD) 调制器,在MATLAB中可以利用工具箱函数和Simulink模块来构建完整的系统。对于具体的应用场景,如设计一个三阶三位九电平的10 MHz、400 MSPS CTSD调制器,可以通过以下方式实现[^1]。 ```matlab % 定义参数 Fs = 400e6; % 采样频率 OSR = 8; % 过采样率 N = OSR * Fs / 2; f_in = 10e6; % 输入信号频率 t = linspace(0, N/Fs, N); input_signal = cos(2*pi*f_in*t); % 构建模拟输入源 analog_input = dsp.SineWave('Amplitude', 1, 'Frequency', f_in, ... 'SampleRate', Fs, 'SamplesPerFrame', length(t)); % 设计噪声整形滤波器 ntf = sdmoddesign(3, FS, 'NTF'); ``` 此段代码初始化了必要的变量并设置了正弦波作为测试激励源。接着定义了一个三阶噪声传输函数(Noise Transfer Function),这是构成&Sigma;Δ调制器的核心部分之一。 #### 使用Simulink搭建仿真环境 除了纯脚本编程外,还可以借助Simulink图形化界面建立更复杂的电路级或系统级别的仿真模型。通过拖拽组件到工作区并连接它们形成闭环结构,能够直观地展示各个子系统的交互过程以及整体性能表现。 #### 绘制频谱图分析输出特性 完成上述步骤之后,可进一步绘制功率谱密度曲线以便观察经过量化后的输出信号特征: ```matlab figure; plot(f(1:N/2), 10*log10(Pyy(1:N/2))); title('Sigma-Delta Modulator Output Spectrum'); xlabel('Frequency (Hz)'); ylabel('Power Spectral Density (dB/Hz)'); grid on; ``` 这段绘图命令展示了如何可视化处理过的数据流,帮助理解实际运行情况下的动态响应特点[^2]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值