当前位置:网站首页>Chapter 18: explore the wonders of the mean in the 2-bit a~b system, specify the 3x+1 conversion process of integers, specify an interval to verify the angular Valley conjecture, explore the number of
Chapter 18: explore the wonders of the mean in the 2-bit a~b system, specify the 3x+1 conversion process of integers, specify an interval to verify the angular Valley conjecture, explore the number of
2022-07-26 03:51:00 【Shares_ four】
//2 position a~b Exploration of the spectacle of the mean bit in hexadecimal
int main()
{
int a, b, c, d, e, g, i, j, p, t;
long s;
printf(" Please enter the interval of port base a,b: ");
scanf("%d, %d", &a, &b);
for (p = a; p <= b; p++)
for (j = 1; j <= p - 1; j++)
{
g = j * p + j;
s = g * g;
d = s;
e = d % p;
d = d / p;
t = 0;
while (d > 0)
{
c = d % p;
d = d / p;
if (c != e)
{
t = 1;
break;
}
}
if (t == 0)
{
printf(" stay %d In base : ", p);
for (i = 1; i <= 2; i++)
if (j < 10)
printf("%ld", j);
else
printf("[%ld]", j);
printf(" ^2=");
while (s > 0)
{
c = s % p;
s = s / p;
if (c < 10)
printf("%ld", c);
else
printf("[%ld] ", c);
}
printf("\n");
}
}
printf(" stay %d-%d We have explored the above wonders of the mean bit \n", a, b);
return 0;
}
result :
// Specify the 3x+1 The transformation process
int main()
{
long int m, n, c;
printf(" please enter an integer m: ");
scanf(" %ld", &m);
n = 0;
c = m;
printf(" %ld", m);
while (c != 1)
{
if (c % 2 == 1)
{
c = 3 * c + 1;
n++; // Odd hour , multiply 3 After add 1
printf("->%ld", c);
}
else
{
c = c / 2;
n++; // Even number , Divide 2
printf("->%ld", c);
}
if (n % 10 == 0)
printf("\n");
if (n > 10000) break;
}
if (n > 10000)
printf("\n Exceed 10000 Step has not completed the conversion .");
else printf("\n Together with %ld Step complete the conversion .\n",n);
return 0;
}
result :
// Specify an interval to verify the angular Valley conjecture
int main()
{
long a, b, c, m,m1, m2,n,max,min;
printf(" Please enter the interval limit a, b: ");
scanf ("%ld,%ld", &a, &b) ;
max=0;
min=100;
for (m=a;m<=b;m++)
{
n=0; c=m;
while (c != 1)
{
if (c % 2 == 1) // Odd hour , multiply 3 After add 1
{
c = 3 * c + 1;
n++;
}
else
{
c = c / 2;
n++; // Even number , Divide 2
}
}
if (n > max) {
max = n;
m1 = m;
} // Find the maximum value of the conversion step
if (n < min) {
min = n; m2 = m;
} // Find the minimum value of the conversion step
}
printf(" When m=%ld The maximum number of conversion steps is , Together with %ld Step through .\n",m1,max);
printf(" When m=%1d The number of conversion steps is the least , Together with %1d Step through .\n", m2, min);
return 0;
}
result :
// verification 3 Number of bit black holes
int main()
{
int i, j, n, n1, m, max;
int sub(int i);
printf(" Verify any 3 digit “ Rearrange the difference ” operation , To 495 or 0. \n");
for (max = 0, n = 100; n <= 999; n++)
{
i = n;
m = 0;
while (i != 495 && i != 0) //m Statistics are converted to 495 The number of times // Conditional discrimination
{
i = sub(i);
m++;
}
if (m > max)
{
max = m;
n1 = n;
j = i; // Maximum number of conversions max
}
}
if (j == 195)
printf(" When n=%d when , At most % d Secondary arrival 495: \n", n1, max);
if (j == 0)
printf(" When n = %d when , At most xd Secondary arrival 0: \n", n1, max);
printf(" %d", n1);
i = n1;
while (i != 495 && i != 0)
{
i = sub(i);
printf("->%d",i);
}
printf(".\n");
}
int sub(int i)
{
int p, k, j, h, max, min, a[4];
a[1] = i / 100;
a[2] = (i / 10) % 10;
a[3] = i % 10;
for (k = 1; k <= 2; k++)
for (j = k + 1; j <= 3; j++)
if (a[k] < a[j])
{
h = a[k];
a[k] = a[j];
a[j] = h;
}
max = a[1] * 100 + a[2] * 10 + a[3];
min = a[3] * 100 + a[2] * 10 + a[1];
p = max - min;
if (p < 100 && p / 10 == p % 10) p = 0;
return (p);
}
result :
// Seek 4 Number of black holes
int main()
{
int i, j, m, n, n1, max;
int sub(int i);
printf(" all 4 The number of digits is “ Rearrange the parameters ” operation , can 6194 or 0\n");
for (max = 0, n = 1000; n <= 9999; n++)
{
i = n;
m = 0;
while (i != 6174 && i != 0)
{
i = sub(i);
m++;
}
if (m > max)
{
max = m;
n1 = n;
j = i;
}
}
if (j == 6174)
printf(" \n %d when , At most %d Secondary arrival 6174: \n", n1, max);
if(j == 0)
printf(" \n %d when , At most %d Secondary arrival 0: \n", n1, max);
printf(" %d",n1);
i = n1;
while (i != 6174 && i != 0)
{
i = sub(i);
printf("->%d", i);
}
printf(".\n");
}
int sub(int i)
{
int p, k, j, h, max, min, a[5];
a[1] = i / 1000;
a[2] = (i / 100) % 10; // hold 1 digit 1 Decompose into 4 A digital
a[3] = (i % 100) / 10;
a[4] = i % 10;
for (k = 1; k <= 3; k++)
for(j = k+1;j <=4;j++)
if (a[k] < a[j])
{
h = a[k];
a[k] = a[j];
a[j] = h;
}
max = a[1] * 1000 + a[2] * 100 + a[3] * 10 + a[4];
min = a[4] * 1000 + a[3] * 100 + a[2] * 10 + a[1];
p = max - min;
if (p < 1000 && p / 100 == (p / 10) % 10 && p / 100 == p % 10)
p = 0;
return (p);
}
result :
边栏推荐
- Testing is not valued? Senior: you should think in another position
- Moco V2: further upgrade of Moco series
- Summary of basic knowledge of C language pointer (I)
- 【读书笔记->数据分析】BDA教材《数据分析》书籍介绍
- Chinese database oceanbase was selected into the Forrester translational data platform report
- 基于JSP实现网上商城系统
- Hurry in!!! Write a number guessing game with dozens of lines of code based on the basic knowledge of C language
- 基于SSM选课信息管理系统
- Leetcode: 102. Sequence traversal of binary tree
- Course selection information management system based on SSM
猜你喜欢
![[create interactive dice roller application]](/img/38/7bb0499bb70c4469428e841fa9c725.png)
[create interactive dice roller application]

redis集群的三种方式

Dat of deep learning

涂鸦幻彩产品开发包如何使用

B2B2C多商户系统功能丰富,极易二开

Testing is not valued? Senior: you should think in another position

PHP connects to MySQL database, and database connects to static tool classes to simplify the connection.

Opencv learning notes - remapping

想要做好软件测试,可以先了解AST、SCA和渗透测试

Dracoo Master天龙卡牌大师
随机推荐
[virtualization] view the log files of vCenter and esxi hosts
Asemi rectifier bridge gbu1510 parameters, gbu1510 specifications, gbu1510 package
div设置高度不生效
第十八章:2位a~b进制中均位奇观探索,指定整数的 3x+1 转化过程,指定区间验证角谷猜想,探求4份黑洞数,验证3位黑洞数
PHP <=> 太空船运算符(组合比较符)
想要做好软件测试,可以先了解AST、SCA和渗透测试
booking.com缤客上海面经
Oracle 11g "password delayed verification" feature
多商户商城系统功能拆解15讲-平台端会员标签
6-40v input fixed 5V 3.3V output 1.1a current 23-5 package
微信小程序实现音乐播放器(4)(使用pubsubjs实现页面间通信)
Data elements
Bond network mode configuration
How does redis implement persistence? Explain the AOF trigger mechanism and its advantages and disadvantages in detail, and take you to quickly master AOF
C language functions (2)
Worked overtime for a week to develop a reporting system. This low code free it reporting artifact is very easy to use
The convolution kernel is expanded to 51x51, and the new CNN architecture slak counterattacks the transformer
括号嵌套问题(建议收藏)
cpu和gpu已过时,npu和apu的时代开始
Bing(必应)搜索,为什么用户越来越多?