System verilog constraint

I am trying to generate a dynamic array with elements in the below fashion
if N = 5, elements should be 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5

Solver is failing to find a solution. Can you help me figure out the issue?

class elements_generation;
  
  parameter N = 5;
  rand int dyn_array [];
  
  function int calculate_size(int n);
    int size;
    for(int i = n; i > 0; i--) begin
      size+=i;
    end
    return size;
  endfunction : calculate_size
  
  constraint c_dyn_array {dyn_array.size() == calculate_size(N);}
  
  constraint c_inc_elements {foreach(dyn_array[i]){if(i>0) (dyn_array[i]==dyn_array[i-1]||(dyn_array[i]-dyn_array[i-1]==1));}}
          
  constraint c_elements {foreach(dyn_array[i]) {dyn_array.sum() with (item == i) == i*i};}
  
endclass : elements_generation
      
module dyn_array_randomization;
  
  initial begin
    elements_generation e_g;
    e_g = new();
    e_g.randomize();
    $display("dyn_array %0p", e_g.dyn_array);
  end
  
endmodule : dyn_array_randomization

In reply to Krishna9:

It is not a random series. Here is a different approach.

class elements_generation;
 
  int N =10;
  rand int dyn_array [];
 
  function int calculate_size(int n);
    return n*(n+1)/2;
  endfunction : calculate_size
  
  function int series(int n);
    return $sqrt(2*n);
  endfunction
  constraint c_size { dyn_array.size == calculate_size(N); }
  constraint c_series { foreach(dyn_array[i]) dyn_array[i] == series(i+1); }

endclass : elements_generation
 
module dyn_array_randomization;
 
  int size;
  initial begin
    elements_generation e_g;
    e_g = new();
    assert(e_g.randomize());
    $display("%0p",e_g.dyn_array);
  end
 
endmodule : dyn_array_randomization

In reply to dave_59:

Thanks for the efficient solution. It requires good math skills to arrive at this.