OFFSET
1,1
COMMENTS
Let p(n) denote the period of u(n,k) (i.e., p(n) is the smallest integer such that u(n,k) = u(n, k+p(n))). p(n) = 22,12,22,21,15,9,15,9,15,9,... for n = 1,2,3,4,5,6,.... Hence for n > 4, p(n) = 15 if n is odd; p(n) = 9 if n is even.
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
a(1)=5, a(2n)=2n+2, a(2n+1)=3n+2.
a(n) = (5*n+5-(n-3)*(-1)^n)/4 for n>=2, with a(1)=5. - Wesley Ivan Hurt, Sep 05 2022
EXAMPLE
E.g., for k=1..15, u(7, k) = 1, 2, 7, 9, 8, 7, 9, 2, 7, 1, 4, 7, 11, 4, 7; hence a(7)=11.
MATHEMATICA
LinearRecurrence[{0, 2, 0, -1}, {5, 4, 5, 6}, 70] (* Georg Fischer, Nov 23 2022 *)
PROG
(Perl)
use strict; use integer;
for (my $n = 1; $n <= 70; $n ++) { my @u = (0, 1, 2, $n);
for (my $k = 1; $k <= 64; $k ++) {
my $sum = $u[$k + 1] + $u[$k + 2];
$u[$k + 3] = ($sum % $u[$k] == 0) ? $sum / $u[$k] : $u[$k];
}
my $max = 0;
for (my $k = 1; $k < scalar(@u); $k ++) {
if ($max < $u[$k]) { $max = $u[$k]; }
}
print "$n $max\n";
} # Georg Fischer, Nov 23 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Apr 11 2002
EXTENSIONS
a(65), a(67), a(69) corrected by Georg Fischer, Nov 23 2022
STATUS
approved