Skip to main content
added 6 characters in body
Source Link
JayCe
  • 3k
  • 13
  • 17

R, 3535 34 bytes

n=scan();(u=(n-n=scan(u=n%%2+1))^2-n%%2-1)/8+2-un+(15+u^2)/8 

Try it online!Try it online!

First output option.Same formula as many other answers (I'd like to point to the first answer providing the formula, I can't figure which it is).

Second and third output options below:

R, 43 bytes

function(m,n=1:m,u=n%%2+1)((n-u)^2-1)/8+2-u 

Try it online!

R, 51 bytes

while(T){cat(((T-(u=T%%2+1))^2-1)/8+2-u," ");T=T+1} 

Try it online!

R, 35 bytes

n=scan();((n-(u=n%%2+1))^2-1)/8+2-u 

Try it online!

First output option.Same formula as many other answers (I'd like to point to the first answer providing the formula, I can't figure which it is).

Second and third output options below:

R, 43 bytes

function(m,n=1:m,u=n%%2+1)((n-u)^2-1)/8+2-u 

Try it online!

R, 51 bytes

while(T){cat(((T-(u=T%%2+1))^2-1)/8+2-u," ");T=T+1} 

Try it online!

R, 35 34 bytes

(u=(n=scan())-n%%2-1)-n+(15+u^2)/8 

Try it online!

First output option.Same formula as many other answers (I'd like to point to the first answer providing the formula, I can't figure which it is).

Second and third output options below:

R, 43 bytes

function(m,n=1:m,u=n%%2+1)((n-u)^2-1)/8+2-u 

Try it online!

R, 51 bytes

while(T){cat(((T-(u=T%%2+1))^2-1)/8+2-u," ");T=T+1} 

Try it online!

added 11 characters in body
Source Link
JayCe
  • 3k
  • 13
  • 17

R, 35 bytes

n=scan();((n-(u=n%%2+1))^2-1)/8+2-u 

Try it online!

First output option.Same formula as many other answers (I'd like to point to the first answer providing the formula, I can't figure which it is).

Second and third output options below:

R, 3743 bytes

function(nm,n=1:m,u=n%%2+1)((n-u)^2-1)/8+2-u 

Try it online!Try it online!

R, 51 bytes

while(T){cat(((T-(u=T%%2+1))^2-1)/8+2-u," ");T=T+1} 

Try it online!

R, 35 bytes

n=scan();((n-(u=n%%2+1))^2-1)/8+2-u 

Try it online!

First output option.Same formula as many other answers (I'd like to point to the first answer providing the formula, I can't figure which it is).

Second and third output options below:

R, 37 bytes

function(n,u=n%%2+1)((n-u)^2-1)/8+2-u 

Try it online!

R, 51 bytes

while(T){cat(((T-(u=T%%2+1))^2-1)/8+2-u," ");T=T+1} 

Try it online!

R, 35 bytes

n=scan();((n-(u=n%%2+1))^2-1)/8+2-u 

Try it online!

First output option.Same formula as many other answers (I'd like to point to the first answer providing the formula, I can't figure which it is).

Second and third output options below:

R, 43 bytes

function(m,n=1:m,u=n%%2+1)((n-u)^2-1)/8+2-u 

Try it online!

R, 51 bytes

while(T){cat(((T-(u=T%%2+1))^2-1)/8+2-u," ");T=T+1} 

Try it online!

Source Link
JayCe
  • 3k
  • 13
  • 17

R, 35 bytes

n=scan();((n-(u=n%%2+1))^2-1)/8+2-u 

Try it online!

First output option.Same formula as many other answers (I'd like to point to the first answer providing the formula, I can't figure which it is).

Second and third output options below:

R, 37 bytes

function(n,u=n%%2+1)((n-u)^2-1)/8+2-u 

Try it online!

R, 51 bytes

while(T){cat(((T-(u=T%%2+1))^2-1)/8+2-u," ");T=T+1} 

Try it online!