Skip to main content
1 of 2
ProgramFOX
  • 8.3k
  • 7
  • 45
  • 70

C#, 116 + 33 = 149 bytes

Not the shortest code, but... it works anyway :P

int[]l(int m){List<int>i=new List<int>();for(int j=1;j<= m;j++){for(int x=0;x<j;x++){i.Add(j);}}return i.ToArray();}

Requires this at the top of the file (33 bytes):

using System.Collections.Generic;

Un-golfed version:

int[] RepatedNumberList(int m)
{
    List<int> intList = new List<int>();
    for (int j = 1; j <= m; j++)
    {
        for (int x = 0; x < j; x++)
        {
            intList.Add(j);
        }
    }
    return initList.ToArray();
}
ProgramFOX
  • 8.3k
  • 7
  • 45
  • 70