Skip to main content
Commonmark migration
Source Link

#R, 34 60 64 bytes

R, 34 60 64 bytes

f=pryr::f;g=f(as.numeric(paste(x,collapse='')));f(g(1:n)+g(n:1))

Assumes pryr package is installed. this gives f as a shorthand for creating functions.

Edit added 26 bytes but returns a function that works, not something entirely wrong.

Edit added another 4 bytes to handle cases above n=10 where strtoi (previously used) was returning NA

#R, 34 60 64 bytes

f=pryr::f;g=f(as.numeric(paste(x,collapse='')));f(g(1:n)+g(n:1))

Assumes pryr package is installed. this gives f as a shorthand for creating functions.

Edit added 26 bytes but returns a function that works, not something entirely wrong.

Edit added another 4 bytes to handle cases above n=10 where strtoi (previously used) was returning NA

R, 34 60 64 bytes

f=pryr::f;g=f(as.numeric(paste(x,collapse='')));f(g(1:n)+g(n:1))

Assumes pryr package is installed. this gives f as a shorthand for creating functions.

Edit added 26 bytes but returns a function that works, not something entirely wrong.

Edit added another 4 bytes to handle cases above n=10 where strtoi (previously used) was returning NA

fix issue with cases n>=10
Source Link
mnel
  • 954
  • 7
  • 10

#R, 34 6060 64 bytes

f=pryr::f;g=f(strtoias.numeric(paste(x,collapse='')));f(g(1:n)+g(n:1))

Assumes pryr package is installed. this gives f as a shorthand for creating functions.

Edit added 26 bytes but returns a function that works, not something entirely wrong.

Edit added another 4 bytes to handle cases above n=10 where strtoi (previously used) was returning NA

#R, 34 60 bytes

f=pryr::f;g=f(strtoi(paste(x,collapse='')));f(g(1:n)+g(n:1))

Assumes pryr package is installed. this gives f as a shorthand for creating functions.

Edit added 26 bytes but returns a function that works, not something entirely wrong.

#R, 34 60 64 bytes

f=pryr::f;g=f(as.numeric(paste(x,collapse='')));f(g(1:n)+g(n:1))

Assumes pryr package is installed. this gives f as a shorthand for creating functions.

Edit added 26 bytes but returns a function that works, not something entirely wrong.

Edit added another 4 bytes to handle cases above n=10 where strtoi (previously used) was returning NA

Post Undeleted by mnel
Fixed lots of bugs
Source Link
mnel
  • 954
  • 7
  • 10

#R, 3434 60 bytes

functionf=pryr::f;g=f(n)strtoi(paste0paste(x,collapse='')));f(g(1:n+nn)+g(n:1))

Uses strtoi to coerce to integerAssumes pryr package is installed. this gives f as a shorthand for creating functions.

Edit added 26 bytes but returns a function that works, not something entirely wrong.

#R, 34 bytes

function(n)strtoi(paste0(1:n+n:1))

Uses strtoi to coerce to integer.

#R, 34 60 bytes

f=pryr::f;g=f(strtoi(paste(x,collapse='')));f(g(1:n)+g(n:1))

Assumes pryr package is installed. this gives f as a shorthand for creating functions.

Edit added 26 bytes but returns a function that works, not something entirely wrong.

Post Deleted by mnel
Source Link
mnel
  • 954
  • 7
  • 10
Loading