15 questions linked to/from Calculate Euler's totient function
17k views

### Tips for golfing in Haskell

What general tips do you have for golfing in Haskell? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Haskell. Please post only one ...
• 1,109
5k views

### Division and remainder

This challenge, while probably trivial in most "standard" languages, is addressed to those languages which are so esoteric, low-level, and/or difficult to use that are very rarely seen on this site. ...
• 12.6k
8k views

### Greatest Common Divisor

Your task is to compute the greatest common divisor (GCD) of two given integers in as few bytes of code as possible. You may write a program or function, taking input and returning output via any of ...
• 717
9k views

### Coprimes up to N

Given a number n >= 2, output all the positive integers less than n where gcd(n, k) == 1 (...
• 7,810
7k views

### Calculate Phi (not Pi)

No, I don't mean $\phi = 1.618...$ and $π = 3.14159...$. I mean the functions. $\phi(x)$ is the number of integers less than or equal to $x$ that are relatively prime to $x$. $π(x)$ is ...
4k views

### Natural Pi #0 - Rock

Goal Create a program/function that takes an input N, check if N random pairs of integers are relatively prime, and returns <...
• 5,716
5k views

### The Möbius Function

The Möbius function is an important number theoretic function. Your submission should accept a positive integer $n$ and return the value of the Möbius function evaluated at $n$. Definition The ...
• 43.8k
6k views

### The program that will find the next prime number

Intro: You accidentally corrupted the flow of time with a device you made for fun, that turned out to be a time machine. As a result, you got pushed to the far future. You realized that computing, ...
• 3,062
2k views

### Co-primality and the number pi

Introduction Number theory is full of wonders, in the form of unexpected connections. Here's one of them. Two integers are co-prime if they have no factors in common other than 1. Given a number $N$,...
• 104k
2k views

### Iterated phi sequence

Related: Iterated phi(n) function. Your challenge is to compute the iterated phi function: f(n) = number of iterations of φ for n to reach 1. Where ...
• 2,436
2k views

### Next Shared Totient

The totient function $\phi(n)$, also called Euler's totient function, is defined as the number of positive integers $\le n$ that are relatively prime to (i.e., do not contain any factor in common ...
• 991
21k views

### Super speedy totient function

The goal is simple: calculate the totient function for as many numbers as you can in 10 seconds and sum the numbers. You must print your result at the end and you must actually calculate it. No ...
• 12.1k
1k views

### Golf the repeated totient function

You will take two positive integers n and x as input, and output Euler's totient function (number of positive integers less than ...
• 49.7k