Exploring the ratio between the count of x/2 and the count of (3*x+1)/2 in original dynamics for extremely large starting integers asymptotically
- Citation Author(s):
- Wei Ren
- Submitted by:
- Wei Ren
- Last updated:
- Thu, 11/08/2018 - 10:34
- Data Format:
We design a computer program that can randomly generate extremely large integers and output their original dynamics. The source code is txpo10b.c. The bit length of integers can be defined by Macro (named MAXLEN) in source code. The number of randomly generated integers can be set by inputting argument. The program can output the original dynamics of a starting integer in terms of “-” presenting (3*x+1)/2 and “0” presenting x/2. This data can be used for observing the relation between the count of “-” and the count of “0”. By analyzing outputting data, we discover that the ratio - the count of “-” over the count of “0” - is 1 asymptotically with the grow of starting integer.
Step 1: Configuring following code in source code of txpo10b.c, which is Macro in C as follows:
#define MAXLEN 100 //the maximal bit length, e.g., 1000, 80000.
txpo10b.c is source code in C that can be compiled into a executable program by any C compiler. It is ANSI C code, thus it can be complied for either Windows or Linux platform.
Step 2: Compile txpo10b.c, generate txpo10b.exe.
txpo10b.exe is an executable program, and can be executed in any DOS command shell in Windows (if compiled for Windows platform) and computing results (as generated files) will be obtained.
Step 3: Run txpo10b.exe by inputting argument that specifying the number of randomly generated integers.
E.g., If MAXLEN is 2000 that specifies the bit length of randomly generated integers, and inputting argument is 4000 that specifies the number of randomly generated integers , then use following command:
tpxo10b.exe 4000 > tpxo10b-len2000-try4000
The data file named tpxo10b-len2000-try4000 will be generated.
Step 4: Compile comp4.c to generate comp4.exe.
Step 5: Run comp4.exe to compute the average and variation of ratios for samples.
E.g., to get the average and variation of ratios for 4000 samples in above data file, just do:
Then, the average and variation of ratios that is count of ``-’’ over count of ``0’’ for 4000 samples will be displayed.
- txpo10b.zip (75.86 MB)