2015-09-30 Math 3600 Hailstone Below

2259 days ago by calkin

We know that if $n \equiv 3 \pmod{4}$

def hailstone2(n): if is_even(n): return(Integer(n/2)) else: return(Integer((3*n+1)/2)) 
       
def hailstone_below(n): count=0 j=n while j>=n: j=hailstone2(j) count+=1 #print(j) return(count) 
       
hailstone2(1) 
       
2
2
hailstone_below(5) 
       
2
2
hailstone_below_list=[] for j in srange(1,100000): hailstone_below_list.append([4*j+3,hailstone_below(4*j+3)]) 
       
list_plot(hailstone_below_list[:100]) 
       

it is apparent that there are regular values for which it takes exactly 4 steps to get below $n$.

for pairs in hailstone_below_list[:100]: if pairs[1]==4: print(pairs, mod(pairs[0],16)) 
       
([19, 4], 3)
([35, 4], 3)
([51, 4], 3)
([67, 4], 3)
([83, 4], 3)
([99, 4], 3)
([115, 4], 3)
([131, 4], 3)
([147, 4], 3)
([163, 4], 3)
([179, 4], 3)
([195, 4], 3)
([211, 4], 3)
([227, 4], 3)
([243, 4], 3)
([259, 4], 3)
([275, 4], 3)
([291, 4], 3)
([307, 4], 3)
([323, 4], 3)
([339, 4], 3)
([355, 4], 3)
([371, 4], 3)
([387, 4], 3)
([403, 4], 3)
([19, 4], 3)
([35, 4], 3)
([51, 4], 3)
([67, 4], 3)
([83, 4], 3)
([99, 4], 3)
([115, 4], 3)
([131, 4], 3)
([147, 4], 3)
([163, 4], 3)
([179, 4], 3)
([195, 4], 3)
([211, 4], 3)
([227, 4], 3)
([243, 4], 3)
([259, 4], 3)
([275, 4], 3)
([291, 4], 3)
([307, 4], 3)
([323, 4], 3)
([339, 4], 3)
([355, 4], 3)
([371, 4], 3)
([387, 4], 3)
([403, 4], 3)

So, it appears that if $ n \equiv 3 \pmod{16}$ then we take exactly 4 steps to get below $n$.

for pairs in hailstone_below_list[:100]: if pairs[1]==5: print(pairs, mod(pairs[0],16)) 
       
([11, 5], 11)
([23, 5], 7)
([43, 5], 11)
([55, 5], 7)
([75, 5], 11)
([87, 5], 7)
([107, 5], 11)
([119, 5], 7)
([139, 5], 11)
([151, 5], 7)
([171, 5], 11)
([183, 5], 7)
([203, 5], 11)
([215, 5], 7)
([235, 5], 11)
([247, 5], 7)
([267, 5], 11)
([279, 5], 7)
([299, 5], 11)
([311, 5], 7)
([331, 5], 11)
([343, 5], 7)
([363, 5], 11)
([375, 5], 7)
([395, 5], 11)
([11, 5], 11)
([23, 5], 7)
([43, 5], 11)
([55, 5], 7)
([75, 5], 11)
([87, 5], 7)
([107, 5], 11)
([119, 5], 7)
([139, 5], 11)
([151, 5], 7)
([171, 5], 11)
([183, 5], 7)
([203, 5], 11)
([215, 5], 7)
([235, 5], 11)
([247, 5], 7)
([267, 5], 11)
([279, 5], 7)
([299, 5], 11)
([311, 5], 7)
([331, 5], 11)
([343, 5], 7)
([363, 5], 11)
([375, 5], 7)
([395, 5], 11)

These values appear to differ by 32 each time, rather than by sixteen.

for pairs in hailstone_below_list[:100]: if pairs[1]==5: print(pairs, mod(pairs[0],32)) 
       
([11, 5], 11)
([23, 5], 23)
([43, 5], 11)
([55, 5], 23)
([75, 5], 11)
([87, 5], 23)
([107, 5], 11)
([119, 5], 23)
([139, 5], 11)
([151, 5], 23)
([171, 5], 11)
([183, 5], 23)
([203, 5], 11)
([215, 5], 23)
([235, 5], 11)
([247, 5], 23)
([267, 5], 11)
([279, 5], 23)
([299, 5], 11)
([311, 5], 23)
([331, 5], 11)
([343, 5], 23)
([363, 5], 11)
([375, 5], 23)
([395, 5], 11)
([11, 5], 11)
([23, 5], 23)
([43, 5], 11)
([55, 5], 23)
([75, 5], 11)
([87, 5], 23)
([107, 5], 11)
([119, 5], 23)
([139, 5], 11)
([151, 5], 23)
([171, 5], 11)
([183, 5], 23)
([203, 5], 11)
([215, 5], 23)
([235, 5], 11)
([247, 5], 23)
([267, 5], 11)
([279, 5], 23)
([299, 5], 11)
([311, 5], 23)
([331, 5], 11)
([343, 5], 23)
([363, 5], 11)
([375, 5], 23)
([395, 5], 11)

So, there are two values $\pmod{32}$ which take exactly 5 steps to get below the starting value.  Note that $32=2^5$!

for pairs in hailstone_below_list: if pairs[1]==6: print(pairs, mod(pairs[0],16)) 
       

So nothing takes exactly 6 steps to get below the starting value.

for pairs in hailstone_below_list[:100]: if pairs[1]==7: print(pairs, mod(pairs[0],128)) 
       
([7, 7], 7)
([15, 7], 15)
([59, 7], 59)
([135, 7], 7)
([143, 7], 15)
([187, 7], 59)
([263, 7], 7)
([271, 7], 15)
([315, 7], 59)
([391, 7], 7)
([399, 7], 15)
([7, 7], 7)
([15, 7], 15)
([59, 7], 59)
([135, 7], 7)
([143, 7], 15)
([187, 7], 59)
([263, 7], 7)
([271, 7], 15)
([315, 7], 59)
([391, 7], 7)
([399, 7], 15)

There appear to be 3 congruences $\pmod{128}$ which take 7 steps to get below the initial value.  Here again, 128 is the 

correct modulus, and $128=2^7$!

for pairs in hailstone_below_list[:200]: if pairs[1]==8: print(pairs, mod(pairs[0],256)) 
       
([39, 8], 39)
([79, 8], 79)
([95, 8], 95)
([123, 8], 123)
([175, 8], 175)
([199, 8], 199)
([219, 8], 219)
([295, 8], 39)
([335, 8], 79)
([351, 8], 95)
([379, 8], 123)
([431, 8], 175)
([455, 8], 199)
([475, 8], 219)
([551, 8], 39)
([591, 8], 79)
([607, 8], 95)
([635, 8], 123)
([687, 8], 175)
([711, 8], 199)
([731, 8], 219)
([39, 8], 39)
([79, 8], 79)
([95, 8], 95)
([123, 8], 123)
([175, 8], 175)
([199, 8], 199)
([219, 8], 219)
([295, 8], 39)
([335, 8], 79)
([351, 8], 95)
([379, 8], 123)
([431, 8], 175)
([455, 8], 199)
([475, 8], 219)
([551, 8], 39)
([591, 8], 79)
([607, 8], 95)
([635, 8], 123)
([687, 8], 175)
([711, 8], 199)
([731, 8], 219)

There are exactly 7 congruences $\pmod{256}$ which take exactly 8 steps to get below the initial value.  256 is the correct modulus, and $256=2^8$.

for pairs in hailstone_below_list: if pairs[1]==9: print(pairs, mod(pairs[0],512)) 
       

There's nothing for 9 steps

for pairs in hailstone_below_list[:800]: if pairs[1]==10: print(pairs, mod(pairs[0],1024)) 
       
([287, 10], 287)
([347, 10], 347)
([367, 10], 367)
([423, 10], 423)
([507, 10], 507)
([575, 10], 575)
([583, 10], 583)
([735, 10], 735)
([815, 10], 815)
([923, 10], 923)
([975, 10], 975)
([999, 10], 999)
([1311, 10], 287)
([1371, 10], 347)
([1391, 10], 367)
([1447, 10], 423)
([1531, 10], 507)
([1599, 10], 575)
([1607, 10], 583)
([1759, 10], 735)
([1839, 10], 815)
([1947, 10], 923)
([1999, 10], 975)
([2023, 10], 999)
([2335, 10], 287)
([2395, 10], 347)
([2415, 10], 367)
([2471, 10], 423)
([2555, 10], 507)
([2623, 10], 575)
([2631, 10], 583)
([2783, 10], 735)
([2863, 10], 815)
([2971, 10], 923)
([3023, 10], 975)
([3047, 10], 999)
([287, 10], 287)
([347, 10], 347)
([367, 10], 367)
([423, 10], 423)
([507, 10], 507)
([575, 10], 575)
([583, 10], 583)
([735, 10], 735)
([815, 10], 815)
([923, 10], 923)
([975, 10], 975)
([999, 10], 999)
([1311, 10], 287)
([1371, 10], 347)
([1391, 10], 367)
([1447, 10], 423)
([1531, 10], 507)
([1599, 10], 575)
([1607, 10], 583)
([1759, 10], 735)
([1839, 10], 815)
([1947, 10], 923)
([1999, 10], 975)
([2023, 10], 999)
([2335, 10], 287)
([2395, 10], 347)
([2415, 10], 367)
([2471, 10], 423)
([2555, 10], 507)
([2623, 10], 575)
([2631, 10], 583)
([2783, 10], 735)
([2863, 10], 815)
([2971, 10], 923)
([3023, 10], 975)
([3047, 10], 999)

There are 12 congruences $\pmod{1024}$, 1024 is the right modulus, and $2^{10}=1024$, of course.

for pairs in hailstone_below_list: if pairs[1]==11: print(pairs, mod(pairs[0],1024)) 
       
for pairs in hailstone_below_list[:3000]: if pairs[1]==12: print(pairs, mod(pairs[0],4096)) 
       
([231, 12], 231)
([383, 12], 383)
([463, 12], 463)
([615, 12], 615)
([879, 12], 879)
([935, 12], 935)
([1019, 12], 1019)
([1087, 12], 1087)
([1231, 12], 1231)
([1435, 12], 1435)
([1647, 12], 1647)
([1703, 12], 1703)
([1787, 12], 1787)
([1823, 12], 1823)
([1855, 12], 1855)
([2031, 12], 2031)
([2203, 12], 2203)
([2239, 12], 2239)
([2351, 12], 2351)
([2587, 12], 2587)
([2591, 12], 2591)
([2907, 12], 2907)
([2975, 12], 2975)
([3119, 12], 3119)
([3143, 12], 3143)
([3295, 12], 3295)
([3559, 12], 3559)
([3675, 12], 3675)
([3911, 12], 3911)
([4063, 12], 4063)
([4327, 12], 231)
([4479, 12], 383)
([4559, 12], 463)
([4711, 12], 615)
([4975, 12], 879)
([5031, 12], 935)
([5115, 12], 1019)
([5183, 12], 1087)
([5327, 12], 1231)
([5531, 12], 1435)
([5743, 12], 1647)
([5799, 12], 1703)
([5883, 12], 1787)
([5919, 12], 1823)
([5951, 12], 1855)
([6127, 12], 2031)
([6299, 12], 2203)
([6335, 12], 2239)
([6447, 12], 2351)
([6683, 12], 2587)
([6687, 12], 2591)
([7003, 12], 2907)
([7071, 12], 2975)
([7215, 12], 3119)
([7239, 12], 3143)
([7391, 12], 3295)
([7655, 12], 3559)
([7771, 12], 3675)
([8007, 12], 3911)
([8159, 12], 4063)
([8423, 12], 231)
([8575, 12], 383)
([8655, 12], 463)
([8807, 12], 615)
([9071, 12], 879)
([9127, 12], 935)
([9211, 12], 1019)
([9279, 12], 1087)
([9423, 12], 1231)
([9627, 12], 1435)
([9839, 12], 1647)
([9895, 12], 1703)
([9979, 12], 1787)
([10015, 12], 1823)
([10047, 12], 1855)
([10223, 12], 2031)
([10395, 12], 2203)
([10431, 12], 2239)
([10543, 12], 2351)
([10779, 12], 2587)
([10783, 12], 2591)
([11099, 12], 2907)
([11167, 12], 2975)
([11311, 12], 3119)
([11335, 12], 3143)
([11487, 12], 3295)
([11751, 12], 3559)
([11867, 12], 3675)
([231, 12], 231)
([383, 12], 383)
([463, 12], 463)
([615, 12], 615)
([879, 12], 879)
([935, 12], 935)
([1019, 12], 1019)
([1087, 12], 1087)
([1231, 12], 1231)
([1435, 12], 1435)
([1647, 12], 1647)
([1703, 12], 1703)
([1787, 12], 1787)
([1823, 12], 1823)
([1855, 12], 1855)
([2031, 12], 2031)
([2203, 12], 2203)
([2239, 12], 2239)
([2351, 12], 2351)
([2587, 12], 2587)
([2591, 12], 2591)
([2907, 12], 2907)
([2975, 12], 2975)
([3119, 12], 3119)
([3143, 12], 3143)
([3295, 12], 3295)
([3559, 12], 3559)
([3675, 12], 3675)
([3911, 12], 3911)
([4063, 12], 4063)
([4327, 12], 231)
([4479, 12], 383)
([4559, 12], 463)
([4711, 12], 615)
([4975, 12], 879)
([5031, 12], 935)
([5115, 12], 1019)
([5183, 12], 1087)
([5327, 12], 1231)
([5531, 12], 1435)
([5743, 12], 1647)
([5799, 12], 1703)
([5883, 12], 1787)
([5919, 12], 1823)
([5951, 12], 1855)
([6127, 12], 2031)
([6299, 12], 2203)
([6335, 12], 2239)
([6447, 12], 2351)
([6683, 12], 2587)
([6687, 12], 2591)
([7003, 12], 2907)
([7071, 12], 2975)
([7215, 12], 3119)
([7239, 12], 3143)
([7391, 12], 3295)
([7655, 12], 3559)
([7771, 12], 3675)
([8007, 12], 3911)
([8159, 12], 4063)
([8423, 12], 231)
([8575, 12], 383)
([8655, 12], 463)
([8807, 12], 615)
([9071, 12], 879)
([9127, 12], 935)
([9211, 12], 1019)
([9279, 12], 1087)
([9423, 12], 1231)
([9627, 12], 1435)
([9839, 12], 1647)
([9895, 12], 1703)
([9979, 12], 1787)
([10015, 12], 1823)
([10047, 12], 1855)
([10223, 12], 2031)
([10395, 12], 2203)
([10431, 12], 2239)
([10543, 12], 2351)
([10779, 12], 2587)
([10783, 12], 2591)
([11099, 12], 2907)
([11167, 12], 2975)
([11311, 12], 3119)
([11335, 12], 3143)
([11487, 12], 3295)
([11751, 12], 3559)
([11867, 12], 3675)

There are 30 congruences $\pmod{2^{12}}$ which require exactly 12 steps to get below the starting value.

m=11 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: print(pairs, mod(pairs[0],2^m)) paircount+=1 print paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: print(pairs, mod(pairs[0],2^(m+1))) paircount+=1 print paircount 
       
0
0
0
0
m=12 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: #print(pairs, mod(pairs[0],2^m)) paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: #print(pairs, mod(pairs[0],2^(m+1))) paircount+=1 print paircount 
       
12 30
60
12 30
60
m=13 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
13 85
14 165
15 340
16 680
17 1360
13 85
14 165
15 340
16 680
17 1360

This suggests very strongly that for some of the numbers which take exactly 13 steps to get below the starting value, the correct modulus is $2^{15}$ rather than $2^{13}$.

m=14 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
14 0
15 0
16 0
17 0
18 0
14 0
15 0
16 0
17 0
18 0
m=15 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
15 88
16 88
17 692
18 1384
19 2768
15 88
16 88
17 692
18 1384
19 2768

Again, this suggests that something strange is going on with 15 steps.  Notice that there are very few instances of 15 in the first $2^{16}$ values!

m=16 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
16 114
17 114
18 1904
19 3808
20 7616
16 114
17 114
18 1904
19 3808
20 7616
m=17 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
17 0
18 0
19 0
20 0
21 0
17 0
18 0
19 0
20 0
21 0
m=18 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
18 63
19 63
20 3844
21 7688
22 15376
18 63
19 63
20 3844
21 7688
22 15376
m=19 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
19 0
20 0
21 0
22 0
23 0
19 0
20 0
21 0
22 0
23 0
m=20 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
20 56
21 56
22 10608
23 21216
24 42432
20 56
21 56
22 10608
23 21216
24 42432
m=21 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
21 53
22 53
23 32180
24 64360
25 128720
21 53
22 53
23 32180
24 64360
25 128720
m=22 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
22 0
23 0
24 0
25 0
26 0
22 0
23 0
24 0
25 0
26 0
m=23 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
23 27
24 27
25 70548
26 84143
27 84143
23 27
24 27
25 70548
26 84143
27 84143

This just indicates we've gone beyond the end of hailstone_below_list

2^26 
       
67108864
67108864
hailstone_below_list[-1] 
       
[39999999, 21]
[39999999, 21]

Let's start again from the beginning.

If n is even, it takes 1 step.

If n is $1 \pmod{4}$ it takes 2 steps.

There are no congruences that take 3 steps.

There is 1 congruence $\pmod{2^4}$ that takes 4 steps.

There are 2 congruences $\pmod{2^5}$ that take 5 steps.

There are no congruences that take 6 steps.

There are 3 congruences $\pmod{2^7}$ that take 7 steps.

There are 7 congruences $\pmod{2^8}$ that take 8 steps.

There are no congruences that take 9 steps.

There are 12 congruences $\pmod{2^{10}}$ that take 10 steps.

There are no congruences  that take 11 steps.

There are 30 congruences $\pmod{2^{12}}$ that take 12 steps.

There are 340 congruences $\pmod{2^{15}}$ that take 13 steps.

There are no congruences that take 14 steps.

There are  692 congruences $\pmod{2^{17}}$ that take 15 steps.

There are 1906 congruences $\pmod{2^{18}}$ that take 16 steps.

 

m=16 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
16 114
17 114
18 1904
19 3808
20 7616
16 114
17 114
18 1904
19 3808
20 7616
m=4 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
4 0
5 1
6 3
7 7
8 15
4 0
5 1
6 3
7 7
8 15

These are all off by 1 because I didn't include the value 3 in the list.

m=5 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
5 2
6 4
7 8
8 16
9 32
5 2
6 4
7 8
8 16
9 32
m=6 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
6 0
7 0
8 0
9 0
10 0
6 0
7 0
8 0
9 0
10 0
m=7 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
7 3
8 6
9 12
10 24
11 48
7 3
8 6
9 12
10 24
11 48
m=8 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
8 7
9 14
10 28
11 56
12 112
8 7
9 14
10 28
11 56
12 112
m=9 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
9 0
10 0
11 0
12 0
13 0
9 0
10 0
11 0
12 0
13 0
m=10 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
10 12
11 24
12 48
13 96
14 192
10 12
11 24
12 48
13 96
14 192
m=11 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
11 0
12 0
13 0
14 0
15 0
11 0
12 0
13 0
14 0
15 0
m=12 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
12 30
13 60
14 120
15 240
16 480
12 30
13 60
14 120
15 240
16 480
m=21 paircount = 0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^m: break if pairs[1]==m: paircount+=1 print m,paircount paircount=0 for pairs in hailstone_below_list[:4000]: if pairs[0]>2^(m+1): break if pairs[1]==m: paircount+=1 print m+1,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+2): break if pairs[1]==m: paircount+=1 print m+2,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+3): break if pairs[1]==m: paircount+=1 print m+3,paircount paircount=0 for pairs in hailstone_below_list: if pairs[0]>2^(m+4): break if pairs[1]==m: paircount+=1 print m+4,paircount 
       
21 53
22 53
23 32180
24 64360
25 128720
21 53
22 53
23 32180
24 64360
25 128720
prob= 1/2 + 1/4+1/2^4 + 2/2^5 + 3/2^7 + 7/2^8 + 12/2^10 + 30/2^12 + 340/2^15 + 692/2^17 + 1906/2^18 + 3844/2^20 + 10608/2^22 + 32180/2^23 
       
prob.n() 
       
0.977781772613525
0.977781772613525
N=10000000 stepprob=[] for steps in range(2,100): tempprob=0 for pair in hailstone_below_list[:N]: #print pair if pair[1]<=steps: tempprob+=1 tempprob=(tempprob/N).n() stepprob.append([steps,tempprob]) #print stepprob 
       
stepprob[-1] 
       
[99, 0.998953300000000]
[99, 0.998953300000000]
y=2000 N=2^y # Range of integers from which we'll choose a random number R=10000 # number of random trials L=1000 # largest step we'll track max_seen=0 # track the largest number of steps we see distn=[0,0,0,0,0,0,0,0] # keep track of how many we see (mod 8) steps_seen=[0 for j in srange(L)] for j in srange(R): n=ZZ.random_element(x=N) distn[mod(n,8)]+=1 steps_taken=hailstone_below(n) if steps_taken > max_seen: max_seen=steps_taken #print steps_taken,is_even(n) if steps_taken<L: steps_seen[steps_taken]+=1 
       
max_seen 
       
132
132
print steps_seen[:20] print distn 
       
[0, 5091, 2466, 0, 643, 628, 0, 221, 250, 0, 125, 0, 58, 97, 0, 44, 75,
0, 38, 0]
[1262, 1223, 1280, 1251, 1277, 1243, 1272, 1192]
[0, 5091, 2466, 0, 643, 628, 0, 221, 250, 0, 125, 0, 58, 97, 0, 44, 75, 0, 38, 0]
[1262, 1223, 1280, 1251, 1277, 1243, 1272, 1192]
list_plot(steps_seen[2:]) 
       
only_steps_seen=[] for j in range(L): if steps_seen[j]>0: only_steps_seen.append([j,steps_seen[j]]) 
       
list_plot(only_steps_seen[30:]) 
       
max(steps_seen) 
       
50143
50143
hailstone_below_list_singles=[] for pair in hailstone_below_list: hailstone_below_list_singles.append(pair[1]) 
       
max(hailstone_below_list_singles) 
       
298
298
hailstone_below(17) 
       
2
2