[Question]
  [
Reading a book is easy, but printing a book can be a bit tricky. When printing a booklet, the printer needs to have the pages arranged in a certain manner in order to be read from left to right. The way this is done is using a pattern like below 
```
n, 1, 2, n-1, n-2, 3, 4, n-3, n-4, 5, 6, n-5, n-6, 7, 8, n-7, n-8, 9, 10, n-9, n-10, 11, 12, n-11…
```
## Test Cases
4 page booklet: `4, 1, 2, 3`
8 page booklet: `8,1,2,7,6,3,4,5` 
12 page booklet: `12,1,2,11,10,3,4,9,8,5,6,7` 
16 page booklet: `16,1,2,15,14,3,4,13,12,5,6,11,10,7,8,9` 
20 page booklet: `20,1,2,19,18,3,4,17,16,5,6,15,14,7,8,13,12,9,10,11`
## Task
Your task is to, given an integer `n` that is a multiple of 4, display an array of numbers that could be used to print a book of `n` pages. 
**Note:** As long as the output generates the correct numbers, whether delimited by spaces, commas, hyphens, or parenthesis, any method to getting to a solution can be used
This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") question so answers will be scored in bytes, with the fewest bytes winning.
  
[Answer]
## JavaScript (ES6), ~~49~~ 45 bytes
*Saved 4 bytes with help from [@RickHitchcock](https://codegolf.stackexchange.com/users/42260/rick-hitchcock)*
```
f=(n,k=1)=>n<k?[]:[n,k,k+1,n-1,...f(n-2,k+2)]
```
### Demo
```
f=(n,k=1)=>n<k?[]:[n,k,k+1,n-1,...f(n-2,k+2)]
console.log(JSON.stringify(f(4)))
console.log(JSON.stringify(f(8)))
console.log(JSON.stringify(f(12)))
console.log(JSON.stringify(f(16)))
console.log(JSON.stringify(f(20)))
```
---
## Non-recursive, 51 bytes
```
n=>[...Array(n)].map((_,i)=>[2*n-i,,++i][i&2]+1>>1)
```
### Demo
```
let f =
n=>[...Array(n)].map((_,i)=>[2*n-i,,++i][i&2]+1>>1)
console.log(JSON.stringify(f(4)))
console.log(JSON.stringify(f(8)))
console.log(JSON.stringify(f(12)))
console.log(JSON.stringify(f(16)))
console.log(JSON.stringify(f(20)))
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~9~~ ~~8~~ 7 bytes
```
L`[Žˆrˆ
```
[Try it online!](https://tio.run/##MzBNTDJM/f/fJ8HT2u10W9Hptv//Dc0A "05AB1E – Try It Online")
**Explanation**
```
L           # push range [1 ... input]
 `          # split as separate to stack
  [Ž        # loop until stack is empty
    ˆ       # add top of stack to global list
     r      # reverse stack
      ˆ     # add top of stack to global list
            # implicitly display global list
```
[Answer]
# Python 2, ~~99~~ ~~93~~ ~~88~~ ~~58~~ ~~56~~ 55 bytes
```
f=input()
for i in range(1,f/2,2):print-~f-i,i,i+1,f-i,
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P802M6@gtERDkystv0ghUyEzT6EoMS89VcNQJ03fSMdI06qgKDOvRCFNN1PbUCdTB0QC2Tr//xsaAQA)
-6 bytes by removing unneeded indentation, thanks Oliver Ni
-5 bytes by changing the conditional, thanks Luis Mendo
-30 bytes by optimizing the print statements, thanks Arnold Palmer
-2 bytes by putting the loop on one line, thanks nedla2004
-1 byte by doing some wizardry, thanks Mr. Xcoder
[Answer]
# [Python 2](https://docs.python.org/2/), 46 bytes
```
lambda n:map(range(1,n+1).pop,n/4*[-1,0,0,-1])
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPKjexQKMoMS89VcNQJ0/bUFOvIL9AJ0/fRCta11DHAAh1DWM1/xcUZeaVKKRpGBppcsHZZpr/AQ "Python 2 – Try It Online")
Generates the range `[1..n]` and pops from the front and back in the repeating pattern `back, front, front, back, ...`
---
**[Python 2](https://docs.python.org/2/), 49 bytes**
```
f=lambda n,k=1:n/k*[0]and[n,k,k+1,n-1]+f(n-2,k+2)
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P802JzE3KSVRIU8n29bQKk8/WyvaIDYxLyUaKKCTrW2ok6drGKudppGnawTkGmn@LyjKzCtRSNMwNNLkgrPNNP8DAA "Python 2 – Try It Online")
Generates the first 4 elements, then recursively continues with the upper value `n` decreased by 2 and the lower value `k` increased by 2.
---
**[Python 2](https://docs.python.org/2/), 49 bytes**
```
lambda n:[[n-i/2,i/2+1][-i%4/2]for i in range(n)]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPKjo6TzdT30gHiLUNY6N1M1VN9I1i0/KLFDIVMvMUihLz0lM18jRj/xcUZeaVKKRpGBppcsHZZpr/AQ "Python 2 – Try It Online")
Directly generates the `i`'th value of the list, using `-i%4/2` as a Boolean for whether to take the lower or higher value.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~68~~ ~~63~~ 62 bytes
*−5 bytes thanks to [@notjagan](https://codegolf.stackexchange.com/users/63641/notjagan) (removing spaces and using `[*...]` instead of `list()`).*
*−1 byte thanks to [@ovs](https://codegolf.stackexchange.com/users/64121/ovs) (`*1` instead of `[:]`)*.
```
def f(n):r=[*range(1,n+1)];return[r.pop(k%4//2-1)for k in r*1]
```
[**Try it online!**](https://tio.run/##TcY7CoAwDADQ3VN0EZL6I9VBFE8iDoKtipCWUAdPXyfBN73wxMNzm9JmnXLAOMg0a1l5t0AlF4TLKDbewrPUwQe48q5pTEXovKhLnaxE05KCnBzBQYeYfe9/J4OYXg "Python 3 – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~19~~ ~~17~~ 10 bytes
```
:t"0&)@o?P
```
[Try it online!](https://tio.run/##y00syfn/36pEyUBN0yHfPuD/f0MjAA)
### Explanation
```
:          % Implicitly input n. Push range [1 2 ... n]
t          % Duplicate
"          % For each (that is, do n times)
  0&)      %   Push last element, and then subarray with remaining elements
  @        %   Push 1-based iteration index
  o?       %   Is it odd? If so
    P      %     Reverse subarray of remaining elements
           %   Implicit end
           % Implicit end
           % Implicitly display stack
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/), ~~12~~ 11 [bytes](https://github.com/DennisMitchell/wiki/Code-page)
Improved to 11 bytes, "Combinatorial Methods":
```
9Bṁ×ḶṚÆ¡‘Œ?
```
**[Try it online!](https://tio.run/##ASMA3P9qZWxsef//OULhuYHDl@G4tuG5msOGwqHigJjFkj////8yMA "Jelly – Try It Online")**
### How?
This uses permutation calculations and the factorial number system:
```
9Bṁ×ḶṚÆ¡‘Œ? - Link n                        e.g. 16
9B          - nine in binary                     [1,0,0,1]
  ṁ         - mould like n                       [1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1]
    Ḷ       - lowered range(n)                   [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
   ×        - multiply                           [0,0,0,3,4,0,0,7,8,0,0,11,12,0,0,15]
     Ṛ      - reverse                            [15,0,0,12,11,0,0,8,7,0,0,4,3,0,0,0]
      Æ¡    - convert from factorial base        19621302981954 (=15*15!+12*12!+...+3*3!)
        ‘   - increment                          19621302981955 (we actually wanted 1*0! too)
         Œ? - shortest permutation of natural numbers [1,2,...] that would reside at that
            -   index in a sorted list of all permutations of those same numbers
            -                                    [16,1,2,15,14,3,4,13,12,5,6,11,10,7,8,9]
```
---
Unimproved 12 byter, "Knitting Patterns":
```
RṚ‘żRs2Z€FḊṁ
```
**[Try it online!](https://tio.run/##ASMA3P9qZWxsef//UuG5muKAmMW8UnMyWuKCrEbhuIrhuYH///8yMA "Jelly – Try It Online")**
### How?
This is the simple approach, it creates two strands, interleaves them and then trims the loose ends:
```
RṚ‘żRs2Z€FḊṁ - Link: n                      e.g. 8
R            - range(n)                          [1,2,3,4,5,6,7,8]
 Ṛ           - reverse                           [8,7,6,5,4,3,2,1]
  ‘          - increment                         [9,8,7,6,5,4,3,2]
    R        - range(n)                          [1,2,3,4,5,6,7,8]
   ż         - zip (interleave)                  [[9,1],[8,2],[7,3],[6,4],[5,5],[4,6],[3,7],[2,8]]
     s2      - split into chunks of length 2     [[[9,1],[8,2]],[[7,3],[6,4]],[[5,5],[4,6]],[[3,7],[2,8]]]
       Z€    - transpose €ach (cross-stitch?!)   [[[9,8],[1,2]],[[7,6],[3,4]],[[5,4],[5,6]],[[3,2],[7,8]]]
         F   - flatten                           [9,8,1,2,7,6,3,4,5,4,5,6,3,2,7,8]
          Ḋ  - dequeue (removes excess start)    [8,1,2,7,6,3,4,5,4,5,6,3,2,7,8]
           ṁ - mould like n (removes excess end) [8,1,2,7,6,3,4,5]
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), ~~43~~ 36 bytes
A port of this answer in C (gcc) [can be found here](https://codegolf.stackexchange.com/a/137978/42418).
```
@(n)[n-(k=1:2:n/2)+1;k;k+1;n-k](:)';
```
# Explanation
1. `k=1:2:n/2`: Generates a linear sequence from 1 to `n/2` in steps of 2. Note that this is immediately used in the next step.
2. `[n-k+1;k;k+1;n-k]`: Creates a 4 row matrix such that the first row creates the sequence `n, n-2, n-4...` down to `n-(n/2)+2`, the second row is `1, 3, 5...` up to `n/2 - 1`, the third row is the second row added by 1 and the fourth row is the first row added by 1.
3. `[n-k+1;k;k+1;n-k](:)'`: This stacks all of the columns of this matrix together from left to right to make a single column vector, and we transpose it to a row vector for easy display. Stacking the columns together this way precisely creates the sequence desired.
Note that this is an anonymous function, so you can assign it to a variable prior to using it, or you can use the built-in `ans` variable that gets created after creating the function.
[Try it online!](https://tio.run/##y08uSSxL/f/fQSNPMzpPVyPb1tDKyCpP30hT29A62zobSObpZsdqWGmqW/9PzCvWMDLQ/P8fAA "Octave – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 48 bytes (improved)
Thanks to @Giuseppe for -7 bytes!
```
n=scan();(x=order(1:n%%2))[order(-(n/2+.5-x)^2)]
```
The trick is that `x=1:n;x[order(x%%2)]` is equivalent to `order(1:n%%2)`.
[Try it online!](https://tio.run/##K/r/P8@2ODkxT0PTWqPCNr8oJbVIw9AqT1XVSFMzGsLV1cjTN9LWM9Wt0Iwz0oz9b2TwHwA "R – Try It Online")
# [R](https://www.r-project.org/), 55 bytes (original)
## Golfed
```
n=scan();x=1:n;x=x[order(x%%2)];x[order(-(n/2+.5-x)^2)]
```
## Ungolfed with comments
Read `n` from stdin.
```
n=scan()
```
Define `x` as sequence of pages from 1 to `n`.
```
x=1:n
```
Order pages so even pages are before uneven pages.
```
x=x[order(x%%2)]
```
Order pages in descending order with respect to the centre of the book computed by `n/2+.5`.
```
x[order(-(n/2+.5-x)^2)]
```
Example with 8 pages:
* centre is 4.5;
* pages 1 and 8 are the most distant from the centre, but 8 comes first because 8 is even;
* pages 2 and 7 are the next most distant from the centre, but 2 comes first as 2 is even;
* and so on.
[Try it online!](https://tio.run/##K/r/P8@2ODkxT0PTusLW0CoPSFZE5xelpBZpVKiqGmnGWsO4uhp5@kbaeqa6FZpxQPH/Rgb/AQ "R – Try It Online")
[Answer]
# Mathematica, ~~54~~ ~~53~~ 45 bytes
```
Join@@Range[#][[(-1)^k{k,-k}]]~Table~{k,#/2}&
```
## Explanation
```
Join@@Range[#][[(-1)^k{k,-k}]]~Table~{k,#/2}&  (* Input: # *)
                              ~Table~{k,#/2}   (* Iterate from k=1 to #/2 *)
      Range[#][[            ]]                 (* From {1..#}, take... *)
                      {k,-k}                   (* k-th and negative k-th element *)
                                               (* negative k-th = k-th from the end *)
                (-1)^k                         (* Reversed for odd k *)
Join@@                                         (* Join the result *)
```
[Answer]
# [Python 2](https://docs.python.org/2/), 64 63 bytes
 -1 byte thanks to [ovs!](https://codegolf.stackexchange.com/users/64121/ovs) 
```
lambda n:sum([[i,i+1,n-i,n+~i]for i in range(1,n/2,2)],[n])[:n]
```
[Try it online!](https://tio.run/##DckxDoAgEATAr1wJ4YyB0sSXIAVG0Ut0NYiFjV9Hp53zKesBV1M/1C3u4xQJ3XXvynthMZbRCMO8EtKRSUhAOWKZ1T@tY6cDewTtO4R6ZkGhpKzT9QM "Python 2 – Try It Online")
[Answer]
## Haskell, 42 bytes
```
n#a|n<a=[]|x<-n-2=n:a:a+1:n-1:x#(a+2)
(#1)
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P085sSbPJtE2OramwkY3T9fINs8q0SpR29AqT9fQqkJZI1HbSJMrzVZD2VDzf25iZp6CrUJBUWZeiYKKQpqCodF/AA "Haskell – Try It Online")
One byte longer:
### Haskell, 43 bytes
```
f n=[1,3..div n 2]>>= \x->[n-x+1,x,x+1,n-x]
```
[Answer]
# Java 8, ~~84~~ 72 bytes
```
n->{for(int j=0;++j<n;System.out.printf("%d,%d,%d,%d,",n--,j++,j,n--));}
```
or
```
n->{for(int j=0;++j<n;System.out.print(n--+","+j+++","+j+","+n--+","));}
```
-12 bytes thanks to *@TheLethalCoder*'s comment on the C# answer.
**Old answer (84 bytes):**
```
n->{int r[]=new int[n],i=1,N=n,J=1;for(r[0]=n;i<n;r[i]=-~i++%4<2?J++:--N);return r;}
```
**Explanation:**
[Try it here.](https://tio.run/##jZDBioMwEIbvPsVQKETU0JZSFlIX9gG2lx7LHtKoJVmdSBILpfjs7mhlDz0JMzD55@Ofnxh5l5ltSzTF76Cb1roAhjTeBV3zL@fkw4soUrX0Hr6lxmcEoDGUrpKqhNP4BLhbXYBipAPGgqSemsoHGbSCEyDkMGD2@aysmzCTb0SSmCOK88OHsuG2C7x1tKrYal2k/7VKMctSkySpGac4Fv0gXu5td63JfT4yZWgoITsH8rldfkDGr3jIFdtPuQDez9XI5s1IfSyitrtl2GERttvMX9YPfw)
```
n->{                  // Method with integer parameter and no return-type
  for(int j=0;++j<n;  //  Loop from 1 to `n` (exclusive)
    System.out.printf("%d,%d,%d,%d,",n--,j++,j,n--)
                      //   Print four numbers simultaneously
  );                  //  End of loop
}                     // End of method
```
[Answer]
# Bash + Perl + Groff + Psutils, 48 bytes
```
perl -nE'say".bp
"x--$_'|groff|psbook>/dev/null
```
Shows output on `stderr`. Output contains some trailing garbage.
Example of use:
```
$ echo 20 | perl -nE'say".bp
> "x--$_'|groff|psbook>/dev/null
[20] [1] [2] [19] [18] [3] [4] [17] [16] [5] [6] [15] [14] [7] [8] [13] [12] 
[9] [10] [11] Wrote 20 pages, 4787 bytes
```
[Answer]
# [Perl 5](https://www.perl.org/), 47 + 1 (-n) = 48 bytes
```
$,=$";print$_--,$i+++1,$i+++1,$_--,''while$_>$i
```
[Try it online!](https://tio.run/##K0gtyjH9/19Fx1ZFybqgKDOvRCVeV1dHJVNbW9sQToGE1NXLMzJzUlXi7VQy//83MviXX1CSmZ9X/F/X11TPwNDgv24eAA "Perl 5 – Try It Online")
[Answer]
# [Swift 3](https://www.swift.org), 74 bytes
```
func g(f:Int){for i in stride(from:1,to:f/2,by:2){print(f-i+1,i,i+1,f-i)}}
```
**[Try it online!](http://swift.sandbox.bluemix.net/#/repl/5987fe4c4d13d32906604380)**
# [Swift 3](https://www.swift.org), 60 bytes
```
{f in stride(from:1,to:f/2,by:2).map{(f-$0+1,$0,$0+1,f-$0)}}
```
For some reason, this does not work in any online environment I have tried so far. If you want to test it, put `var g=` in front of it, and call it with `print(g(12))` in [Xcode (Playgrounds)](https://developer.apple.com/xcode/).
Here is a picture after I've ran it in an Xcode playground, version 8.3.1 (Running Swift 3.1):
[![enter image description here](https://i.stack.imgur.com/yA4iU.png)](https://i.stack.imgur.com/yA4iU.png)
[Answer]
# [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), 25 bytes
```
[1,:/2,2|?b-a+1,a,1+a,b-a
```
Although the input is %4, the actual rhythm is 2-based.
## Explanation
```
[1,:/2,2|   FOR ( b=1; b <= <input>/2; b=b+2)               
?           PRINT
 b-a+1,     n
 a,         1
 1+a,       2
 b-a        n-1
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 66 bytes
A port of [my Octave answer](https://codegolf.stackexchange.com/a/137901/42418) to C (gcc):
```
f(n,i){for(i=1;i<n/2;i+=2)printf("%d %d %d %d ",n-i+1,i,i+1,n-i);}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9NI08nU7M6Lb9II9PW0DrTJk/fyDpT29ZIs6AoM68kTUNJNUUBjpR08nQztQ11MnVAJJCtaV37PzcxM08jWadMMzkjsUhLq8y6Ok0jsSQ/U6Ms2jBWE6Tiv5EBAA "C (gcc) – Try It Online")
[Answer]
# [cQuents](https://github.com/stestoltz/cQuents), 21 bytes
```
=n::n-z+1,z+1,x-1,z-1
```
[Try it online!](https://tio.run/##Sy4sTc0rKf7/3zbPyipPt0rbUAeEK3SBtK7h//@GRgA "cQuents – Try It Online")
## Explanation
```
                            Implicit input n
=n                          First item in the sequence is n
  ::                        Mode :: (Sequence 2): print sequence from 1 to n
                            Comma delimited items are rotated through
    n-z+1,                    n - previous + 1
          z+1,                previous + 1
              x-1,            third-previous - 1
                  z-1         previous - 1
```
[Answer]
# [R](https://www.r-project.org/), ~~64~~ 60 bytes
Devastatingly outgolfed by [djhurio](https://codegolf.stackexchange.com/a/138045/67312)! His answer is quite elegant, go upvote it.
```
n=scan();matrix(c(n-(k=seq(1,n/2,2))+1,k,k+1,n-k),4,,T)[1:n]
```
A port of [rayryeng's Octave answer](https://codegolf.stackexchange.com/a/137901/67312).
[Try it online!](https://tio.run/##K/r/P8@2ODkxT0PTOjexpCizQiNZI09XI9u2OLVQw1AnT99Ix0hTU9tQJ1snG0jm6WZr6pjo6IRoRhta5cX@t/gPAA "R – Try It Online")
### original solution (64 bytes):
```
f=function(n,l=1:n)`if`(n,c(l[i<-c(n,1,2,n-1)],f(n-4,l[-i])),{})
```
Recursive function.
[Try it online!](https://tio.run/##Dcc7CsAgDADQvSdJShxSnKSeRASLEBAklX6GUnp26/be0bt4uTVfZVdQqp6dYiqSRjLUUFaTB5kWUsMYSUCNpRpMiYj0ftjPrbX6ADs7WxKcpP8 "R – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 50 bytes
A port of [Arnauld's JS answer](https://codegolf.stackexchange.com/a/137882).
```
f=lambda n,k=1:n>k and[n,k,k+1,n-1]+f(n-2,k+2)or[]
```
[Try it online!](https://tio.run/##DcdBCoAgEAXQq/yl0QQ5RIRQFxEXRkhijSFtOr25eIv3fO@ZhWsN6@Xv/fAQSqs2siV4OWwbpV6TDNr1QcnArdzlYl0NuSAiCuxEWAiam5nAozN4SpQXQcWu/g "Python 2 – Try It Online")
[Answer]
# [Pyth](https://pyth.readthedocs.io), ~~21~~ 20 bytes
```
sm[hK-QddhdK):1/Q2 2
```
**[Test Suite.](http://pyth.herokuapp.com/?code=sm%5BhK-QddhdK%29%3A1%2FQ2+2&input=12&test_suite=1&test_suite_input=4%0A8%0A12%0A16&debug=0)**
If outputting as a nested list is allowed:
# [Pyth](https://pyth.readthedocs.io), ~~20~~ 19 bytes
```
m[hK-QddhdK):1/Q2 2
```
**[Test Suite.](http://pyth.herokuapp.com/?code=m%5BhK-QddhdK%29%3A1%2FQ2+2&input=12&test_suite=1&test_suite_input=4%0A8%0A12%0A16&debug=0)**
---
# Explanation
```
sm[hK-QddhdK):1/Q2 2  - Full program.
 m           :1/Q2 2  - Map over range(1,input()/2,2) with a variable d.
  [         )         - Construct a list with:
   hK-Qd                - Input - d + 1,
        d               - d,
         hd             - d + 1 and
           K            - Input - d.
s                     - Flattens the list and prints implicitly.
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), 40 bytes
```
->n{1.step(n/2,2){|x|p n-x+1,x,x+1,n-x}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6v2lCvuCS1QCNP30jHSLO6pqKmQCFPt0LbUKdCB0QC2bW1/9OijQxi/wMA "Ruby – Try It Online")
[Answer]
## C#, 107 bytes
```
int[]F(int p){var a=new int[p];for(int i=0,q=1;q<p;a[i++]=p--){a[i++]=p--;a[i++]=q++;a[i++]=q++;}return a;}
```
Keep two counters, one starting at 1, one at p. In each loop iteration, write four elements and just increment or decrement counters after each entry. When the counters meet in the middle, stop.
```
int[] F(int p)
{
    var a = new int[p];
    for(int i = 0, q = 1; q < p; a[i++] = p--)
    {
        a[i++] = p--;
        a[i++] = q++;
        a[i++] = q++;
    }
    return a;
}
```
[Answer]
# [Haskell](https://www.haskell.org/), 58 bytes
```
(x:y:r)#(a:b:s)=x:y:a:b:r#s
f n=take n$n:[1..]#[n-1,n-2..]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/X6PCqtKqSFNZI9EqyapY0xbEBTGLlIu50hTybEsSs1MV8lTyrKIN9fRilaPzdA118nSNgOz/uYmZeQq2CrmJBb4KGgVFmXklCnoKaZoK0SY6FjqGRjqGZjpGBrH/AQ "Haskell – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~27~~ ~~24~~ 23 bytes
-3 bytes by printing throughout instead of at the end.
-1 Thanks to Mr. Xcoder
```
V:1/Q2 2pjd[-QtNNhN-QNk
```
[Try it online!](https://tio.run/##K6gsyfj/P8zKUD/QSMGoICslWjewxM8vw0830C/7/39DMwA "Pyth – Try It Online")
[Or on the online Compiler/Executor](https://pyth.herokuapp.com/?code=V%3A1%2FQ2+2pjd%5B-QtNNhN-QNk&input=16&debug=1 "Pyth Compiler/Executor")
This is my first real program in Pyth, so there's probably better methods that I don't know about.
# Explanation
```
V:1/Q2 2pjd[-QtNNhN-QNk
V:1/Q2 2                   # For N in range(1, Q/2, 2):
        pjd                # print " ".join(...),
           [-QtNNhN-QNk    # The list [n - (N-1), N, N + 1, n - N, ""] (n is input)
```
[Answer]
# [C++ (gcc)](https://gcc.gnu.org/), ~~89~~ ~~84~~ 68 bytes
As unnamed generic lambda. `n` is #pages (%4==0) and `C` is a reference parameter for the result, an empty container like `vector<int>` (only `push_back` is needed).
```
[](int n,auto&C){for(int i=0,j=0;i<n;C.push_back(++j%4<2?n--:++i));}
```
previous solution:
```
#define P C.push_back(
[](int n,auto&C){for(int i=0;i<n;P n--),P++i),P++i),P n--));}
```
[Try it online!](https://tio.run/##VU5LboMwEN37FCOiVlhAhSJW2CaLHKOqKteY1CkMFra7iTg7BZNUym7ef5S1xUWp5WBQ9aHV3IzOT1oODfmnfrXy49QQEpzBC6ActLNSaXC@ZYTI4EfoxPL@kRr0gPlGvJ7prRunyBhR5ldRMsORnd9scN@fX1L9pFl2fan48YRFUWeZoZTNy9q3RQZpMKVwI/AoQVEx5OJYMsxEFaVtv6737/jqaWDSLvSerVKXYr4jyh5ONQYPnEOCICDZLoywhiRG7ku2vgdX7jlooz3f7U9KBBrbflVmMi9/ "C++ (gcc) – Try It Online")
Slightly ungolfed:
```
auto f=
[](int n,auto&C){
 for(int i=0,j=0;
     i<n;
     C.push_back(++j%4<2 ? n-- : ++i));
}
```
previous solution slightly ungolfed:
```
auto f=
[](int n, auto&C){
 for(
  int i=0;
  i<n;
   P n--),
   P++i),
   P++i),
   P n--)
 );
}
;
```
It was quite straightforward developed and there are sure some minor optimizations in the arithmetics.
* Edit1: unification of the arithmetics saved 5 byte
* Edit2: after the unification the 4 steps were combined
Usage:
```
std::vector<int> result;
f(n, result);
```
### Print-Variant, 77 bytes out-dated
If you insist on printing the values, there is this solution:
```
[](int n,auto&o){for(int i=0;i<n;o<<n--<<' '<<++i<<' '<<++i<<' '<<n--<<' ');}
```
Where `o` is your desired `std::ostream`, like `std::cout`
Usage (if 2nd lambda was assigned to `g`):
```
g(n, std::cout);
```
[Answer]
# Common Lisp, 79 bytes
```
(defun f(n &optional(k 1))(and(> n k)`(,n,k,(1+ k),(1- n),@(f(- n 2)(+ k 2)))))
```
[Try it online!](https://tio.run/##FYjBDYAgEARb2ZfZi/jAAoylaFQSAjmIYv147md25sjxqb3zvMKrCFQMpbZYdM9M8CLc9eQCRZKNTl1y9KOJYYKKWxloB7PQsuFfZ72jNjDAW@kf)
[Answer]
## Lua, 94 bytes
For this challenge I actually came up with 2 different methods that are both 94 bytes.
**Method 1:**
```
function f(n,i)i=i or 1 return n>i and('%s,%s,%s,%s,%s'):format(n,i,i+1,n-1,f(n-2,i+2))or''end
```
**Commented Code:**
```
function f(n,i)
  i=i or 1
  -- On the first iteration i will be nil so I'm setting it's value to 1 if it is.
  return n>i and ('%s,%s,%s,%s,%s'):format(n,i,i+1,n-1,f(n-2,i+2)) or ''
  -- Here i return a ternary statement
  -- If n>i is true, it will return a string using string.format() and part of this is recursion
  -- If it's false, it will just return an empty string
end
```
**Method 2:**
```
function f(n,i)i=i or 1 return n>i and n..','..i..','..i+1 ..','..n-1 ..','..f(n-2,i+2)or''end
```
This method is similar to the first method however I'm instead returning a concatenated string instead of string.format()
In both methods I have used the concept of n and i getting closer together
[Answer]
# PHP, 51+1 bytes
```
while($i<$k=&$argn)echo$k--,_,++$i,_,++$i,_,$k--,_;
```
prints page numbers separated by underscore with a trailing delimiter.  
Run as pipe with `-nR` or [try it online](http://sandbox.onlinephpfunctions.com/code/20f77d274bc8f7dca0a1d2b18874752db015c813).
]