用C编写一个程序,输出给定数字之间的大量数字序列的第一项和项数

用C编写一个程序,输出给定数字之间的大量数字序列的第一项和项数,c,algorithm,math,numbers,C,Algorithm,Math,Numbers,富足数是一个自然数,其固有因子之和大于该数本身。我必须用C写一个程序,它将取两个自然数k和m,假设k,我认为这个赋值可以这样解释。考虑一个数字n/p> N not abundant N+1 abundant N+2 abundant N+3 abundant N+4 not abundant 这里有一个由3个丰富的数字组成的序列,因此必须输出长度为3,数字为N+1 因此,您需要跟踪序列长度和序列的起始编号 int current_sequence_length = 0; // Inc

富足数是一个自然数,其固有因子之和大于该数本身。我必须用C写一个程序,它将取两个自然数k和m,假设k,我认为这个赋值可以这样解释。考虑一个数字n/p>
N not abundant 
N+1 abundant 
N+2 abundant 
N+3 abundant 
N+4 not abundant 
这里有一个由3个丰富的数字组成的序列,因此必须输出长度为3,数字为N+1

因此,您需要跟踪序列长度和序列的起始编号

int current_sequence_length = 0; // Increment when you find an abundant number
                                 // Set to zero when you find a not abundant number

int current_sequence_start = 0;  // Set to the number that starts a new sequence
然后您需要跟踪最长的序列,因此您需要:

int longest_sequence_length = 0;

int longest_sequence_start = 0;
每当序列结束时,必须执行以下操作:

if (current_sequence_length > longest_sequence_length)
{
    longest_sequence_length = current_sequence_length;
    longest_sequence_start = current_sequence_start;
}

请显示示例输入及其预期输出!
if (current_sequence_length > longest_sequence_length)
{
    longest_sequence_length = current_sequence_length;
    longest_sequence_start = current_sequence_start;
}