Challenge programming Programming Competition Training Manual-1.6.13N + 1 problem(3N + 1 problem)
Code:
Public class problem_3n_add_1 {/*** @ Param ARGs */public static void main (string [] ARGs) {int I = 900; // The initial value is Int J = 1000; // final value int result = maxcount (I, j); // maximum number of operations system. out. print (I + "" + J + "" +
Karaz (Callatz) conjecture:For any natural number n, if it is even, cut it in half, and if it is odd, cut it off by half (3n+1). This has been repeatedly cut down, and finally must be in a certain step to get n=1. Karaz at the 1950 World Mathematicians conference published this conjecture, the legend of Yale University teachers and students to mobilize, desperate
Tags: Programming Algorithm data structure C ++
Example 2-1 AABB
Output all the four-digit full records in the form of AABB (that is, the first two digits are equal, and the last two digits are also equal)
#include Conclusion: one group of Reverse Thinking solves the same problem
2. Use the variable n = A * 1100 + B * 11 to store four digits.
3. There will be errors in floating point operations. When the floating point error is performed, t
Karaz (Callatz) conjecture:For any natural number n, if it is even, cut it in half, and if it is odd, cut it off by half (3n+1). This has been repeatedly cut down, and finally must be in a certain step to get n=1. Karaz at the 1950 World Mathematicians conference published this conjecture, the legend of Yale University teachers and students to mobilize, desperate
1005. Continue (3n+1) conjecture
Title: https://www.patest.cn/contests/pat-b-practise/1005
Caraz (Callatz) conjecture has been described in 1001. In this topic, the situation is slightly complicated.
When we verify the Caraz conjecture, in order to avoid repeated computations, we can record the number of times encountered in the recursion process. For example, when n=3 is validated, we need to compute 3,
Conjecture: For any natural number greater than 1 N, if n is odd, then n becomes 3n+1, otherwise it becomes half of N.After a number of such transformations, the n will be changed to 1. such as 3->10->5->16->8->2->1.Enter N, the number of times the transformation is output.
the numbers I and j you is to determine the maximum cycle length through all numbers between I and J.InputThe input would consist of a series of pairs of integers I and J, one pair of integers per line. All integers is is less than and greater than 0.You should process all pairs of integers and for each pair determine the maximum cycle length to all integers between an D including I and J.OutputFor all pair of input integers I and j should output I, j, and the maximum cycle length for integers
3038 3n+1 Problemstime limit: 1 sspace limit: 32000 KBtitle level: Silver SolvingTitle Description Description The 3n+1 problem is a simple, interesting and unsolved mathematical problem. This problem is made by L. Collatz was introduced in 1937. The Korazim problem (Collatz
3038 3N + 1 Problems
Time Limit: 1 s space limit: 32000 kb title level: Silver silver Title Description
DescriptionThe 3N + 1 problem is a simple and interesting but unsolved mathematical problem. This issue was raised by L. Collatz in 1937. Collatz Problem is also called ha
Http://uva.onlinejudge.org/index.php? Option = com_onlinejudge Itemid = 8 page = show_problem problem = 36
The 3N+ 1 problem
Background
Problems in computer science are often classified as belonging to a certain class of problems (e.g ., NP, unsolvable, recursive ). in this problem you will be analyzing a property of an algorithm whose classification is not known for all possible
1001. (3n+1) Conjecture of Killing people (15)Karaz (Callatz) conjecture:For any natural number n, if it is even, cut it in half, and if it is odd, cut it off by half (3n+1). This has been repeatedly cut down, and finally must be in a certain step to get n=1. Karaz at the 19
1001. Death penalty (3n+1) conjecture (15) time limit MS Memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Chen, YueKaraz (Callatz) conjecture:For any natural number n, if it is even, cut it in half, and if it is odd, cut it off by half (3n+1). This has been repeatedly cut down, and finally must b
1001. Death penalty (3n+1) conjecture (15) time limit MS Memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Chen, YueKaraz (Callatz) conjecture:For any natural number n, if it is even, cut it in half, and if it is odd, cut it off by half (3n+1). This has been repeatedly cut down, and finally must b
1001. Death penalty (3n+1) conjecture time limit MS Memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Chen, YueKaraz (Callatz) conjecture:For any natural number n, if it is even, cut it in half, and if it is odd, cut it off by half (3n+1). This has been repeatedly cut down, and finally must be in
one.
2. There is no limit on the relative size of the two numbers I and J in the question. That is to say, I> J may occur and need to be judged.
Code:
Method 1:
#include
Method 2:
#include
Appendix:
Range
Maximum value that may be encountered during Calculation
Answer
[1, 10]
52
20
[1,100]
9232
119
[
1005. Continuation (3n+1) conjecture
Karaz (Callatz) conjecture has been given a description in 1001. In this subject, the situation is slightly more complicated.
When we verify Karaz conjecture, in order to avoid repetition, we can record each number that is encountered in the recursive process. For example, when validating n=3 n=3, we need to calculate 3, 5, 8, 4, 2,
Topic description
Description3n+1 problem is a simple, interesting and unsolved mathematical problem. This problem is made by L. Collatz was introduced in 1937. The Korazim problem (Collatz problem) is also called hailstone problem, 3n+1 problem, Hasse algorithm problem, Kakutani algorithm problem, Thwaites conjecture, or Ulam problem. The problem is as follo
Karaz (Callatz) conjecture:
For any natural number n, if it is even, cut it in half, and if it is odd, cut it off by half (3n+1). This has been repeatedly cut down, and finally must be in a certain step to get n=1. Karaz at the 1950 World Mathematicians conference published this conjecture, the legend of Yale University teachers and students to mobilize, desp
Karaz (Callatz) conjecture:For any natural number n, if it is even, cut it in half, and if it is odd, cut it off by half (3n+1). This has been repeatedly cut down, and finally must be in a certain step to get n=1. Karaz at the 1950 World Mathematicians conference published this conjecture, the legend of Yale University teachers and students to mobilize, desperate
Karaz (Callatz) conjecture:For any natural number n, if it is even, cut it in half, and if it is odd, cut it off by half (3n+1). This has been repeatedly cut down, and finally must be in a certain step to get n=1. Karaz at the 1950 World Mathematicians conference published this conjecture, the legend of Yale University teachers and students to mobilize, desperate
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.