Linked Questions

27
votes
35answers
4k views

Calculate Euler's totient function

Background Euler's totient function φ(n) is defined as the number of whole numbers less than or equal to n that are relatively ...
39
votes
100answers
5k views

Divisibility test

Task Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd. You ...
27
votes
20answers
2k views

Tips for golfing in x86/x64 machine code

I noticed that there's no such question, so here it is: Do you have general tips for golfing in machine code? If the tip only applies to a certain environment or calling convention, please specify ...
31
votes
42answers
3k views

Least Common Multiple

The least common multiple of a set of positive integers A is the smallest postive integer B such that, for each ...
52
votes
75answers
9k views

Do n and n^3 have the same set of digits?

Given a number n (0 <= n <= 2642245), check if n and n3 have the same set of digits, and output a truthy or falsey value accordingly. For example, let's check the number 100. 1003 is 1000000. ...
76
votes
24answers
14k views

Shortest code to throw SIGILL

Background We already have a challenge about throwing SIGSEGV, so why not a challenge about throwing SIGILL? What is SIGILL? SIGILL is the signal for an illegal instruction at the processor, which ...
39
votes
22answers
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 <...
14
votes
14answers
2k views

Compute the Wilson numbers

Given a positive integer n, compute the nth Wilson number W(n) where and e = 1 if n has a primitive root modulo n, otherwise e = -1. In other words, n has a primitive root if there does not exist an ...
22
votes
14answers
2k views

The Euclidean Algorithm (for finding the greatest common divisor)

The Challenge Write a program or function that takes two input integers, i and j, and outputs their greatest common divisor; ...
28
votes
8answers
2k views

Codeium Golfide

In this challenge, your task is to take an anion and a cation, and output the chemical formula of the compound. The input follows these rules: Take in 2 strings (in any order) representing the anion ...
14
votes
25answers
1k views

Adding fractions

Write a program or a function that takes two non-empty lists of the same length as input and does the following: uses elements of first list to get numerators, uses elements of the second list to get ...