c# Efficient solution: Sequence generator for a pattern This is an interview question to generate the below pattern of numbers in a sequence, which is: 12.34, 23.45, 45.67, 78.910, 1112.1314, 1617.1819, 2223.2425, 2930.3132, 3738.3940, 4647.4849, 5657.5859, 6768.6970, 7980.8182, 9293.9495, 106107.108109, 121122.123124 We can use starting seed number as 12 and have to generate all the 16 numbers programmatically without using strings. We can use only arrays but no other built-in collection classes or data structures.
public static void GenerateSequence()
{
    int j = 1;
    ArrayList sequenceList = new ArrayList();

    for (int count = 0; count &lt; 16; count++)
    {
        j = j + count;
        int quotent = getValue(j, j + 1);
        int reminder = getValue(j + 2, j + 3);
        int length = getLength(reminder);
        double result = Convert.ToUInt32(quotent) * getLength(reminder) + reminder;
        sequenceList.Add(result / length);
    }
    Console.WriteLine(sequenceList.ToString());
}

static int getValue(int a, int b)
{
    return a * getLength(b) + b;
}

static int getLength(int value)
{
    int length = (int)(Math.Log10(value) + 1);
    int formattedValue = 10;

    for (int i = 1; i &lt; length; i++)
        formattedValue = formattedValue * 10;

    return formattedValue;
}

I've arrived with above solution but this looks complex and less efficient. Looking for an alternate approach with better time/space complexity.
public static void GenerateSequence() {
    double tenPower(double n) =&gt; Math.Pow(10, Math.Floor(Math.Log10(n)+1));
    double build(double n) =&gt; n * tenPower(n + 1) + n + 1;
    double merge(double n1, double n2) =&gt; n1 + n2 / tenPower(n2);

    var n = 1;
    var ans = new double[16];
    for (int j1 = 0; j1 &lt; 16; ++j1) {
        n += j1;

        var whole = build(n);
        var frac = build(n + 2);
        ans[j1] = merge(whole, frac);
    }
    
    foreach (var a in ans)
        Console.WriteLine(a);
}