Skip to main content
Commonmark migration
Source Link

#MATL, 11 10 bytes

MATL, 11 10 bytes

1 byte saved thanks to @Luis

YPiEY$GH+)

This solution utilizes 1-based indexing

Try it Online

All test cases

Explanation

YP  % Pre-defined literal for pi
iE  % Grab the input and multiply by 2 (to ensure we have enough digits to work with)
Y$  % Compute the first (iE) digits of pi and return as a string
G   % Grab the input again
H+  % Add 2 (to account for '3.') in the string
)   % And get the digit at that location
    % Implicitly display the result

#MATL, 11 10 bytes

1 byte saved thanks to @Luis

YPiEY$GH+)

This solution utilizes 1-based indexing

Try it Online

All test cases

Explanation

YP  % Pre-defined literal for pi
iE  % Grab the input and multiply by 2 (to ensure we have enough digits to work with)
Y$  % Compute the first (iE) digits of pi and return as a string
G   % Grab the input again
H+  % Add 2 (to account for '3.') in the string
)   % And get the digit at that location
    % Implicitly display the result

MATL, 11 10 bytes

1 byte saved thanks to @Luis

YPiEY$GH+)

This solution utilizes 1-based indexing

Try it Online

All test cases

Explanation

YP  % Pre-defined literal for pi
iE  % Grab the input and multiply by 2 (to ensure we have enough digits to work with)
Y$  % Compute the first (iE) digits of pi and return as a string
G   % Grab the input again
H+  % Add 2 (to account for '3.') in the string
)   % And get the digit at that location
    % Implicitly display the result
added 41 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52

#MATL, 1111 10 bytes

1 byte saved thanks to @Luis

YPiEY$VGH+YPiEY$GH+)

This solution utilizes 1-based indexing

Try it OnlineTry it Online

All test casesAll test cases

Explanation

YP  % Pre-defined literal for pi
iE  % Grab the input and multiply by 2 (to ensure we have enough digits to work with)
Y$  % Compute the first (iE) digits of pi and return as a string
G   % Grab the input again
H+  % Add 2 (to account for '3.') in the string
)   % And get the digit at that location
    % Implicitly display the result

#MATL, 11 bytes

YPiEY$VGH+)

This solution utilizes 1-based indexing

Try it Online

All test cases

#MATL, 11 10 bytes

1 byte saved thanks to @Luis

YPiEY$GH+)

This solution utilizes 1-based indexing

Try it Online

All test cases

Explanation

YP  % Pre-defined literal for pi
iE  % Grab the input and multiply by 2 (to ensure we have enough digits to work with)
Y$  % Compute the first (iE) digits of pi and return as a string
G   % Grab the input again
H+  % Add 2 (to account for '3.') in the string
)   % And get the digit at that location
    % Implicitly display the result
added 120 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52

#MATL, 11 bytes

YPiEY$VGH+)

This solution utilizes 1-based indexing

Try it Online

All test cases

#MATL, 11 bytes

YPiEY$VGH+)

This solution utilizes 1-based indexing

Try it Online

#MATL, 11 bytes

YPiEY$VGH+)

This solution utilizes 1-based indexing

Try it Online

All test cases

Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading