Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 365 characters in body
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61

PHP, 54 bytes

function($x){for(;$y<$x;$a[]=range(++$y,1));return$a;}

Try it online!

Or recursive:

PHP, 54 bytes

function f($x){return$x?f($x-1)+[$x=>range($x,1)]:[];}

Try it online!

Or with PHP-formatted printed output:

PHP , 38 bytes

for(;$x<$argn;print_r(range(++$x,1)));

Try it online!

PHP, 54 bytes

function($x){for(;$y<$x;$a[]=range(++$y,1));return$a;}

Try it online!

Or recursive:

PHP, 54 bytes

function f($x){return$x?f($x-1)+[$x=>range($x,1)]:[];}

Try it online!

PHP, 54 bytes

function($x){for(;$y<$x;$a[]=range(++$y,1));return$a;}

Try it online!

Or recursive:

PHP, 54 bytes

function f($x){return$x?f($x-1)+[$x=>range($x,1)]:[];}

Try it online!

Or with PHP-formatted printed output:

PHP , 38 bytes

for(;$x<$argn;print_r(range(++$x,1)));

Try it online!

add recursive version
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61

PHP, 54 bytes

function($x){for(;$y<$x;$a[]=range(++$y,1));return$a;}

Try it online!

Or recursive:

PHP , 54 bytes

function f($x){return$x?f($x-1)+[$x=>range($x,1)]:[];}

Try it online!

PHP, 54 bytes

function($x){for(;$y<$x;$a[]=range(++$y,1));return$a;}

Try it online!

PHP, 54 bytes

function($x){for(;$y<$x;$a[]=range(++$y,1));return$a;}

Try it online!

Or recursive:

PHP , 54 bytes

function f($x){return$x?f($x-1)+[$x=>range($x,1)]:[];}

Try it online!

deleted 13 characters in body
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61

PHP, 6454 bytes

function($x){foreach(rangefor(1,$x)as$a)$b[]=range;$y<$x;$a[]=range($a++$y,1);return$b;);return$a;}

Try it online! Try it online!

PHP, 64 bytes

function($x){foreach(range(1,$x)as$a)$b[]=range($a,1);return$b;}

Try it online!

PHP, 54 bytes

function($x){for(;$y<$x;$a[]=range(++$y,1));return$a;}

Try it online!

deleted 11 characters in body
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading

AltStyle によって変換されたページ (->オリジナル) /