June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -5,18 +5,18 @@ print_hailstone(integer h)
|
|||
|
||||
while (h ^ 1) {
|
||||
lb_p_integer(l, h);
|
||||
h = __hold(h & 1, 3 * h + 1, h / 2);
|
||||
h = h & 1 ? 3 * h + 1 : h / 2;
|
||||
}
|
||||
|
||||
o_form("hailstone sequence for ~ is ~1 ~ ~ ~ .. ~ ~ ~ ~, it is ~ long\n",
|
||||
l[0], l[1], l[2], l[3], l[-3], l[-2], l[-1], 1, l_length(l) + 1);
|
||||
l[0], l[1], l[2], l[3], l[-3], l[-2], l[-1], 1, ~l + 1);
|
||||
}
|
||||
|
||||
void
|
||||
max_hailstone(integer x)
|
||||
{
|
||||
integer e, i, m;
|
||||
record r;
|
||||
index r;
|
||||
|
||||
m = 0;
|
||||
i = 1;
|
||||
|
|
@ -26,16 +26,16 @@ max_hailstone(integer x)
|
|||
h = i;
|
||||
l = 1;
|
||||
while (h ^ 1) {
|
||||
if (r_j_integer(k, r, itoa(h))) {
|
||||
if (i_j_integer(k, r, h)) {
|
||||
l += k;
|
||||
break;
|
||||
} else {
|
||||
l += 1;
|
||||
h = __hold(h & 1, 3 * h + 1, h / 2);
|
||||
h = h & 1 ? 3 * h + 1 : h / 2;
|
||||
}
|
||||
}
|
||||
|
||||
r_f_integer(r, itoa(i), l - 1);
|
||||
r[i] = l - 1;
|
||||
|
||||
if (m < l) {
|
||||
m = l;
|
||||
|
|
@ -45,7 +45,7 @@ max_hailstone(integer x)
|
|||
i += 1;
|
||||
}
|
||||
|
||||
o_form("hailstone sequence length for ~ is ~ long\n", e, m);
|
||||
o_form("hailstone sequence length for ~ is ~\n", e, m);
|
||||
}
|
||||
|
||||
integer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue