using System;
public class Program
{
public static void Main()
int n = 23;
Console.WriteLine($"Ascendant({n}): {Algorithms.Ascendant(23)}");
}
public static class Algorithms
public static int? Ascendant(int n)
if (n < 2)
return null;
if (n == 2)
return 1;
var root = 2;
var left = root + 1;
var right = root + root;
while (right < n)
Console.WriteLine($"{root} = [{left}|{right}]");
root += 1;
left = right + 1;
right = right + root;
return root;