All Questions

Filter by
Sorted by
Tagged with
7
votes
8answers
67 views

Calculate the inverse of a matrix

Somehow, we don't yet have a challenge for finding the inverse of an arbitrarily-sized square matrix, despite having ones for 3x3 and 4x4, as well as a more complex version. Your task is, given a ...
0
votes
0answers
68 views

Is a coincident point in a pair of rotated hexagonal lattices closest to the origin?

Preface This is a code-golf question where the technique must search or exclude from search all possibilities. As soon as I figure out how to pose it, there will be a separate code-challenge question ...
12
votes
5answers
251 views

What valence does this APL train have?

Context In APL, trains are tacit sequences of monadic/dyadic functions that can be called with one or two arguments. We'll code something to check if a given train follows the correct structure we ...
25
votes
14answers
1k views

Is it a digit haiku?

We can read 13576870234289 digit-by-digit in English, and it makes a haiku: one three five seven six eight seven zero two three four two eight nine We say it's a &...
14
votes
8answers
1k views

The square root of the square root of the square root of the…

This code-golf challenge will give you an integer n, and ask you to count the number of positive integer sequences \$S = (a_1, a_2, \dots, a_t)\$ such that \$a_1 + ...
7
votes
11answers
511 views

Output ISO8601 date string from seconds and nanoseconds

One reason why ISO8601 is the best date string format, is that you can simply append as much precision as you like. Given 2 integers representing seconds and nanoseconds that have passed since ...
23
votes
9answers
2k views

The Knight's Dialer

Imagine you place a knight chess piece on a phone dial pad. This chess piece moves from keys to keys in an uppercase "L" shape: two steps horizontally followed by one vertically, or one step ...
-6
votes
0answers
98 views

palindrome in lua [closed]

I have written a code for palindrome in lua but the code says it is not a palindrome if there is a capital letter in the string tc = tonumber(io.read()) for i=1,tc do ...
-7
votes
0answers
61 views

Chess: Is there a check? [duplicate]

You get a string representation of a chessboard. It consists of 64 characters going row wise from top left to bottom right. The figures are denoted with: K king Q queen R rook, castle B bishop N ...
8
votes
2answers
144 views

Unscramble the letters by letter frequency analysis [closed]

You know those riddles where every letter is swapped for another letter? E.g. you get a text like ...
15
votes
11answers
1k views

Rectangles in rectangles

This code-golf challenge will give you two positive integers n and k as inputs and have you count the number of rectangles with ...
12
votes
8answers
2k views

We're much closer than you think

Martin Ender's 2D programming language Alice has two different modes depending on what orientation the IP has: orthogonal (Cardinal mode) or diagonal (Ordinal mode). Commands in Alice change their ...
19
votes
16answers
2k views

A Portuguese sequence of integers

Context Consider the following sequence of integers: $$2, 10, 12, 16, 17, 18, 19, ...$$ Can you guess the next term? Well, it is \$200\$. What about the next? It is \$201\$... In case it hasn't become ...
17
votes
5answers
460 views

Triangles with rational side lengths

This challenge will have give you a positive integer \$n\$ and ask you to output \$t(n)\$, the number of triangles (up to congruence) satisfying the three conditions: The triangles have perimeter of ...
20
votes
18answers
1k views

Eating Persistence

Intro Find the result of number cannibalism. Why was 6 scared of 7? Becase 7 8 9. Your program will have to find the result of applying the ...
1
vote
1answer
79 views

Simple “hyena” program [duplicate]

Write a program that takes a string as an input. For the input: If the input doesn't match the source code, the program shall output the input intact. (Hence a cat) Otherwise, the program shall fall ...
13
votes
19answers
2k views

Create an Accurate How-To Article

Here is an easy-intermediate challenge for anyone interested! What is that? A thing me and brother do a bit too often is this: One of us has a problem and asks the other to explain how to do certain ...
21
votes
19answers
913 views

Sequences of distinct positive integers

The goal of this challenge is to take a positive integer n and output (in lexicographic order) all sequences \$S = [a_1, a_2, ..., a_t]\$ of distinct positive ...
6
votes
21answers
1k views

Output all of printable ASCII using all of printable ASCII

Output all 95 bytes from 0x20 to 0x7E inclusive (printable ASCII including space), in any order, each at least once. The source ...
-3
votes
0answers
61 views

Second order Turing machine [closed]

I was thinking about a second order busy beaver which uses a halting oracle. I believe that such a program is well defined for n < 5 and could involve executing the program for 108 steps (that is S(...
21
votes
13answers
2k views

Decide a C integer literal

Objective Given an ASCII string, decide whether it is a valid C integer literal. C integer literal A C integer literal consists of: One of: 0 followed by zero or ...
-8
votes
0answers
53 views

Construct the Euler Circuit for a hyper cube of dimension N, where N is an even, positive integer [closed]

ssume the coordinates of the cube vertices are vectors containing only zero and one. your output is a list of vertices in the order in which they are to be traversed, ending in 0000..0
29
votes
20answers
3k views

Looks prime to me!

Figuring out whether a given number is prime, while not very complicated, is kind of hard. But making a guess doesn't need to be. Seeing whether a number is a multiple of 2 or 5 is easy - you can just ...
30
votes
31answers
2k views

Targeted duplicate removal

The task In this challenge, you are given a number and a list. Your task is to remove from the list all occurrences of the given number except the first (leftmost) one, and output the resulting list. ...
14
votes
20answers
2k views

We're all unique in our own way

This is an answer-chaining challenge where every part of your answer should aim to be unique from every other answer. This question will work in the following way: I will post the first answer. The ...
20
votes
42answers
3k views

Converting Strings to Decimals (Gone Wrong)

What? Many programming languages, both practical and esoteric, have functions, methods, etc to convert a given string to a decimal number. This is how the process might work: For each character in ...
11
votes
6answers
318 views

Geohash my positions

About geohash Geohash is one of many encoding systems for geographic positions. Geohash positions have some advantages. It provides a short code instead of the two usual numbers for latitude and ...
18
votes
13answers
963 views

Find all integer pairs that produce a given Loeschian number

Inspired by and drawns from Is this number Loeschian? A positive integer \$k\$ is a Loeschian number if \$k\$ can be expressed as \$i^2 + j^2 + i\times j\$ for \$i\$, \$j\$ integers. For example, ...
8
votes
2answers
204 views

Inverse quine: print everything except your program

Write a program which will eventually, given enough time, print all possible permutations of ASCII characters (both printable and non-printable) less than or equal to its length, except itself. The ...
28
votes
7answers
3k views

Shortest “arithmetic” formula to output 1000 primes

Write a formula using only the digits 0-9, +, *, -, <...
7
votes
3answers
284 views

Shortest pristine truth machine

In this challenge, the goal is to create a pristine truth machine in as few bytes as possible. For reference, a truth machine does the following: Takes input, which is always 0 or 1 If the input is 0,...
37
votes
17answers
2k views

Three other numbers

Given three distinct numbers from \$1\$ to \$7\$, output three other distinct numbers from \$1\$ to \$7\$, that is having no numbers in common with the original numbers. Your code must produce a ...
22
votes
2answers
690 views

Extend the most recent “nice” OEIS sequence: stepping stone puzzle on a grid

Today Neil Sloane of the OEIS sent out an email asking for a confirmation of the current terms, and computation of some larger terms of the latest OEIS sequence A337663 with the keyword "nice&...
21
votes
12answers
2k views

Find a divisibility pattern

Background Sometimes when I'm golfing a program, I'm presented with the following situation: I have an integer value \$x\$ on some fixed interval \$[a, b]\$, and I'd like to test whether it's in some ...
10
votes
7answers
1k views

Peel away the layers - Robbers

This is the Robbers thread. For the Cops challenge, see here As the robbers, your job is to crack the cops' answers. Choose an uncracked, unsafe cop answer and attempt to figure out which languages, ...
20
votes
11answers
2k views

Peel away the layers - Cops

In this cops-and-robbers challenge, robbers must crack cop answers by finding out which languages the cops used. This is the Cops thread. For the Robbers' challenge, see here Cops, you are to write a ...
13
votes
6answers
1k views

Solve 4x4 Mastermind in exactly 5 steps

Background Mastermind is a game of code-breaking for two players. One of the players is codemaker (Alice) and the other is codebreaker (Bob). 4x4 means that the player should guess the length-4 ...
10
votes
5answers
538 views

Parse a Scala expression

Scala isn't a very commonly used language around here. Most of those who know it like it[citation needed], but some go :\ when they encounter its user-defined ...
19
votes
16answers
2k views

Size up a number

Intro Given a whole number \$< 100,\$ extend/shorten the english representation of the number to have as many characters as it's value. Sandbox Rules Take the number \$n\$, and get it in words ...
7
votes
8answers
563 views

Count Euler's Tours

Leonhard Euler wants to visit a few friends who live in houses 2, 3, ..., N (he lives in house 1). However, because of how his city is laid out, none of the paths between any houses form a loop (so, ...
6
votes
6answers
781 views

TTT: Turing Text Tape

Introduction Ah, INTERCAL... As much as I'd like encourage everyone to Try it Online, text output is just painful. According to the docs it uses the "Turing Text Model". While an... ...
14
votes
15answers
2k views

Palindrome distance

Find what is the distance for a given string to its closest palindrome of the same length. For this task I decided to give the characters further away from the string's center more weight (think of it ...
2
votes
4answers
415 views

Parse a nested parentheses

Objective Mimic Haskell's reads :: ReadS (). Or in other words, parse nested parentheses. Since the target type is () (the type ...
14
votes
4answers
395 views

Bad matrix multiplication that gives the right answer

Executive summary: Print NxN matrices \$A\$ and \$B\$ where \$ AB = 10A + B \$. Largest N wins! Details: Entrants in this challenge should choose an N. Submit a program that takes an input integer '...
-1
votes
0answers
80 views

Shortest C program which compiles to largest file size [duplicate]

Challenge This challenge is to create the shortest C program which compiles to the largest file size. Your score for this challenge is ...
11
votes
1answer
374 views

Amount Of Potential Keys That'll Fit The Lock

Introduction: You're a key maker, and want to access something from a safe that has a lock. Unfortunately, the key to that lock is lost, so you'll have to make a new one. You have access to a bunch of ...
19
votes
36answers
4k views

Is that number a Two Bit Number™️?

Let's start by defining a Two Bit Number™️: It is a positive integer When expressed as a binary string it has exactly 2 true bits OR When expressed as a decimal number, it has exactly 2 of the ...
11
votes
1answer
172 views

Pristine Polyglots

As the title says, you are to create a pristine program in as many languages as possible. A pristine program, taken from here, is: Let's define a pristine program as a program that does not have any ...
18
votes
5answers
2k views

How happy is this emoticon? (2.0)

OG post Task In this challenge, you will be given an string emoticon, and your task will be to output its happiness. How? An emoticon will always have eyes and mouth. It can also include eyebrows and ...
16
votes
27answers
2k views

Compactify the query string

Introduction Just on Hacker news, John Resig contemplates transforming a query “foo=1&foo=2&foo=3&blah=a&blah=b” into one that looks like this: “foo=1,2,3&blah=a,b", https://...

15 30 50 per page
1
2 3 4 5
237