g | x | w | all
Bytes Lang Time Link
019Raku Perl 6 rakudo240731T061736Zbb94
029Haskell240731T020609ZMaroonSp
006Japt240730T220016ZShaggy
015Desmos240118T144546ZJoao-3
032Google Sheets240201T105853Zz..
030Labyrinth240121T234347ZBubbler
051Python240119T071004ZAlbert.L
062Python 3.8 prerelease240118T135305ZGáb
131Java 10240118T102609ZKevin Cr
054dc240118T153951ZcamelCas
004Jelly240118T022319ZFmbalbue
005APLDyalog Unicode240118T004349ZTbw
041Perl 5240117T233725ZKjetil S
011Charcoal240118T100321ZNeil
044JavaScript Node.js240118T003551Zl4m2
003Jelly240118T103749ZJonathan
043Retina240118T100052ZNeil
013Wolfram Language Mathematica240118T094433ZZaMoC
015PARI/GP240118T092417Zalephalp
009Uiua SBCS240118T083938Zchunes
005MathGolf240118T075910ZKevin Cr
00505AB1E240118T075535ZKevin Cr
029Funge98240118T040510ZAlt Shif
055Scala 3240118T021844Z138 Aspe
004Vyxal240118T011320Zemanresu
007J240118T001253ZBubbler
046JavaScript V8240117T235331ZArnauld
170C gcc240117T231031Zvengy

Raku (Perl 6) (rakudo), 19 bytes

{2..$_ X+[*] 1..$_}

Attempt This Online!

Haskell, 29 bytes

f n=map(product[2..n]+)[2..n]

Try it online

Japt, 6 bytes

ò2È+UÊ

Try it here

Desmos, 15 bytes

f(n)=[2...n]+n!

Try it in Desmos!

The simplest a solution can get, to be honest.

Google Sheets, 32 bytes

=SORT(FACT(A1)+SEQUENCE(A1-1)+1)

Labyrinth, 30 bytes

?:}  @\!
 (:{+ ""
*; :=;;
#(;)

Try it online!

Introducing "small-loop-oriented programming" ;)

?    program start; take n from stdin
     let's say n = 4
     [ 4 | ]

:}   run in the order of :(:}
(:   : dup               [ 4 4 | ]
     ( decrement         [ 4 3 | ]
     : dup               [ 4 3 3 | ]
     } move to aux.stack [ 4 3 | 3 ]
     loop until the top is 0 after `decrement`
     [ 4 3 2 1 0 | 1 2 3 ]

*;   run in the order of ;*#(
#(   ; drop         [ 4 3 2 1 | 1 2 3 ]
     * mul          [ 4 3 2 | 1 2 3 ]
     # stack height [ 4 3 2 3 | 1 2 3 ]
     ( decrement    [ 4 3 2 2 | 1 2 3 ]
     loop until the top is 0 after `decrement`, i.e. stack height is 1
     [ 24 0 | 1 2 3 ]

;)   drop 0, and increment the factorial
     [ 25 | 1 2 3 ]

{+   run in the order of :=+{
:=   : dup                 [ 25 25 | 1 2 3 ]
     = swap the tops       [ 25 1 | 25 2 3 ]
     + add                 [ 26 | 25 2 3 ]
     { move from aux.stack [ 26 25 | 2 3 ]
     loop until the top is 0 after `swap the tops`
     [ 26 27 28 25 0 | 25 ]

;;   drop twice [ 26 27 28 | 25 ]

\!   run in the order of ""!\  (" is no-op)
""   ! pop and print as num
     \ print a newline
     loop until the top is zero, i.e. there is nothing left to print

@    end the program

Python, 51 bytes

f=lambda n:range((n<2or(f(n-1).stop-n)*n)-~n)[1-n:]

Attempt This Online!

Returns a range object.

Original Python, 56 bytes

f=lambda n:[n*([*f(n-1),3][0]-2)+j+2for j in range(n-1)]

Attempt This Online!

Python 3.8 (pre-release), 69 62 bytes

lambda n:[i-~math.factorial(n)for i in range(1,n)]
import math

Try it online!

Edit: changed math.prod to math.factorial, thanks to @l4m2

Java 10, 134 131 bytes

n->{var f=n.ONE;int N=n.intValue(),i=N;for(;i>1;)f=f.multiply(n.valueOf(i--));for(;i++<N;)System.out.println(f.add(n.valueOf(i)));}

-3 bytes thanks to @ceilingcat.

Input as a BigInteger, outputs on separated lines to STDOUT.

Try it online.

Explanation:

n->{                            // Method with BigInteger as parameter and no return:
  var f=n.ONE;                  //  Start `f` with BigInteger 1
  int N=n.intValue(),           //  Set `N` to the input-BigInteger as integer
  i=N;for(;i>1;)                //  Loop `i` in the range [N,1):
    f=f.multiply(n.valueOf(i)); //   Multiply `f` by `i`
  for(;i++<N;)                  //  Loop `i` again, this time in the range (1,N]:
    System.out.println(         //   Print with trailing newline:
      f.add(n.valueOf(i)));}    //    `f` + `i`

dc, 56 54 bytes

[dlf*sf1-d0!=q]sq1sf?d1-sm[dlf2++p0=m1+dlm!=e]selqxlex

Try it online!

This solution isn't the most optimized, you could probably use less registers than I did here.

Jelly, 4 bytes

RḊ+!

Try it online!

Port of Vyxal answer.

-1 byte thanks to @emanresu A

Explanation:

RḊ+!­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏‏​⁡⁠⁡‌⁢​‎⁠‎⁡⁠⁣‏⁠‎⁡⁠⁤‏‏​⁡⁠⁡‌­
RḊ    # ‎⁡[2 .. n]
  +!  # ‎⁢+ n!
💎

Created with the help of Luminespire.

APL(Dyalog Unicode), 5 bytes SBCS

1↓⍳+!

Try it on APLgolf!

A tacit function that takes an integer on the right and returns an array of n-1 composite numbers.

Explanation

    ! ⍝ factorial
   +  ⍝ plus
  ⍳   ⍝ range
1↓    ⍝ drop the first

There are actually two other permutations of these five characters that produce the same result. See if you can find them. ;)

6 bytes, outputs full numbers under \$10^{34}\$

⍕1↓⍳+!

Try it! This requires adding (⎕FR⎕PP)←1287 34 to the header to set the float and printing precision.

Perl 5, 41 bytes

sub{@a=1..pop;$"='*';map$_+1+eval"@a",@a}

Try it online!

Charcoal, 11 bytes

≔…·²NθI⁺θΠθ

Try it online! Link is to verbose version of code.

≔…·²Nθ

Create a list from 2 up to n inclusive.

I⁺θΠθ

Vectorised add the list to its product.

Of course, the given formula is just an existence proof and there are usually lower runs. For instance, the LCM is readily proven to produce a run:

Nθ≔…·²θηW⌈﹪±θη≧⁺ιθI⁺θη

Try it online! Link is to verbose version of code. Or more efficiently:

Nθ≔…·²θηFη≔⌊Φ×⊖ηθ¬﹪κιθI⁺θη

Try it online! Link is to verbose version of code.

JavaScript (Node.js), 52 51 47 46 45 44 bytes

f=(n,i=n)=>--n&&f(n,g=i*n)>console.log(n-~g)

Try it online!

-1 byte from Arnauld/tsh

JavaScript (Node.js), 38 bytes by Mukundan314

f=(n,i=n)=>--n?[...f(n,g=i*n),n-~g]:[]

Try it online!

Jelly, 3 bytes

Ḋ+!

Try it online!

A monadic Link that accepts a positive integer, \$n\$, and yields a list of the \$n-1\$ consecutive integers.

How?

Ḋ+! - Link: integer, n
Ḋ   - dequeue {n}      -> [2, 3, 4, ..., n]
  ! - {n} factorial    -> n!
 +  - add (vectorises) -> [2+n!, 3+n!, 4+n!, ..., n+n!]

Retina, 43 bytes

.+
*
v`__+
$.&$*
L$`\d+
$$.($&*_$=
%~`^
.+¶

Try it online! Outputs the numbers in descending order. Explanation:

.+
*

Convert n to unary.

v`__+
$.&$*

Create an expression n*...*3*2* that evaluates to n! in unary.

L$`\d+
$$.($&*_$=

For each integer in that expression, create an expression that adds i and converts to decimal.

%~`^
.+¶

Evaluate each resulting expression.

Wolfram Language (Mathematica), 13 bytes

#!+2~Range~#&

Try it online!

PARI/GP, 15 bytes

n->[n!+2..n!+n]

Attempt This Online!

Uiua SBCS, 9 bytes

↘1+/×.+1⇡

Try it!

MathGolf, 5 bytes

╒╞\!+

Try it online.

Explanation:

╒      # Push a list in the range [1, (implicit) input]
 ╞     # Remove the first value to make the range [2,input]
  \    # Swap to push the (implicit) input
   !   # Take its factorial
    +  # Add it to each value in the list
       # (after which the entire stack is output implicitly as result)

05AB1E, 5 bytes

L¦¤!+

Try it online or verify all test cases.

Explanation:

L      # Push a list in the range [1, (implicit) input]
 ¦     # Remove the first value to make the range [2,input]
  ¤    # Push the last item (without popping the list): the input
   !   # Take its factorial
    +  # Add it to each value in the list
       # (after which this list is output implicitly as result)

Funge-98, 29 bytes

"HTMI"4(&:F2+v
\I_@#:-2\I.: <

Try it online!

Scala 3, 55 bytes

n=>{val a=(1 to n).map(BigInt(_));a.map(_+1+a.product)}

Attempt This Online!

Vyxal, 4 bytes

Ḣ?¡+

Try it Online!

Ḣ    # range(2, n+1)
   + # + 
 ?¡  # n!

J, 7 bytes

!-<:$i:

Attempt This Online!

Returns the list of numbers in reverse order. When given a bigint, outputs the exact numbers in bigint.

!-<:$i:    input: n, a positive integer
     i:    [-n, -n+1, ..., n]
  <:       n-1
    $      take first n-1 items from the list, i.e. [-n, ..., -2]
!          n!
 -         n! - each item of [-n, ..., -2]
           == [n!+n, n!+n-1, ..., n!+2]

J, 8 bytes

!+-.{.i:

Attempt This Online!

Returns the list of numbers in the order given.

!+-.{.i:    input: n, a positive integer
      i:    [-n, -n+1, ..., n]
  -.        1-n
    {.      since 1-n is negative, take n-1 items from the end;
            [2, ..., n]
!+          add n! to each item of the list

JavaScript (V8), 46 bytes

Prints the results in reverse order.

n=>{for(p=i=n;--i;)p*=i;while(--n)print(p-~n)}

Try it online!


JavaScript (ES11), 52 bytes

With BigInts.

n=>{for(p=i=n;--i;)p*=i;while(--n)console.log(p-~n)}

Try it online!

C (gcc), 170 bytes

Using The GNU Multiple Precision Arithmetic Library

f(n){mpz_t f,t;mpz_init(f);mpz_init(t);mpz_set_ui(f,1);for(int i=1;i<=n;mpz_mul_ui(f,f,i++));for(int i=2;i<=n;mpz_add_ui(t,f,i),mpz_out_str(stdout,10,t),puts(""),i++);}

Try it online!