OFFSET
1,2
COMMENTS
REFERENCES
R. K. Guy, Unsolved Problems in Number Theory, 3rd ed., Springer, 2004; Section E35.
LINKS
Enrique Pérez Herrero, Table of n, a(n) for n = 1..10000
EXAMPLE
Corner of the array (with terms of A356026 bracketed):
[1] 2 3 4 5 6
2 [3] 4 5 6 7
2 4 [5] 6 7 8
4 6 2 [7] 8 9
2 8 6 9 [4] 10
9 10 6 11 8 [12]
MATHEMATICA
a = Join[{{1}},
NestList[
Flatten[{#, Range[Last[#] + 1, Last[#] + 3]} &[
Flatten[Transpose[{Reverse[#[[1]]], #[[2]]} &[
Partition[#, Length[#]/2] &[
Drop[#, {(Length[#] + 1)/2}] &[#]]]]]]] &, {2, 3, 4}, 200]];
Take[a, 9] // TableForm; (* the array, right-abbreviated *)
Flatten[Map[Take[#, {(Length[#] + 1)/2}] &, a]] (* A356026 *)
(* Peter J. C. Moses, Jul 23 2022 *)
(* Alternate recursive code *)
KL[i_, j_] := i + j - 1 /; (j >= 2 i - 3);
KL[i_, j_] := KL[i - 1, i + (j - 2)/2] /; (EvenQ[j] && (j < 2 i - 3));
KL[i_, j_] := KL[i - 1, i - (j + 3)/2] /; (OddQ[j] && (j < 2 i - 3));
KL[i_] := KL[i] = KL[i, i]; SetAttributes[KL, Listable];
A356026[n_] := KL[n];
Array[A356026, 30]
(* Enrique Pérez Herrero, Jan 12 2023 *)
PROG
(PARI)
KL(i, j) =
{
my(i1, j1);
i1=i;
j1=j;
while(j1<(2*i1-3),
if(j1%2,
j1=i1-((j1+3)/2),
j1=i1+((j1-2)/2)
);
i1--;
);
return(i1+j1-1);
}
A356026(i)=KL(i, i);
\\ Enrique Pérez Herrero, Jan 12 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Jul 23 2022
STATUS
approved