Answers for "r"

1

r

R is a programming language and free software 
environment for statistical computing and graphics
supported by the R Foundation for Statistical
Computing. The R language is widely used among 
statisticians and data miners for developing 
statistical software and data analysis.
Posted by: Guest on February-03-2021
1

R

R is a programming language
and free software environment for statistical
computing and graphics supported by the R Foundation for Statistical Computing.
The R language is widely used among statisticians and data miners for developing statistical 
software and data analysis.
Posted by: Guest on June-24-2021
0

r

/*
  * Source:
  *   https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
  * 
  * Description:
  *   Calculates prime numbers till a number n
  * 
  * Time Complexity:
  *   O(n log(log(n)))
  */

List<bool> sieve_of_eratosthenes(int n) {
  // Input: n: int
  // Output: is_prime: List<bool> denoting whether ith element is prime or not
  List<bool> is_prime = new List.filled(n + 1, true);
  is_prime[0] = false;
  is_prime[1] = false;
  for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
      for (int j = i * i; j <= n; j += i) {
        // mark all multiples of i as false
        is_prime[j] = false;
      }
    }
  }
  return is_prime;
}

main() {
  // Prints all the primes under 50
  List<bool> primes = sieve_of_eratosthenes(50);
  for (int i = 2; i <= 50; i++) {
    if (primes[i]) {
      print(i);
    }
  }
}
Posted by: Guest on June-21-2021
0

R

R - Functional programming language and environment for 
statistical computing and graphics.
R's Awesome List
https://github.com/qinwf/awesome-R#readme
Posted by: Guest on January-02-2021

Browse Popular Code Answers by Language