All Questions

Filter by
Sorted by
Tagged with
13
votes
11answers
2k views

Letters associated with prime numbers

If we assign each letter a respective integer, starting from 1, then a is 1, b is 2, c is 3, and so on. After z, the letters loop back around, but with a in front (aa, ab, ac). It then goes to ba, bb, ...
15
votes
17answers
2k views

Plain Hunt Bell-Ringing

Your task is to create a plain hunt (a bell ringing pattern) with n bells. An example with 6 bells: ...
27
votes
33answers
5k views

Make a haystack (with a needle)

(Essentially the inverse of Find the needle in the haystack) Given two tuples, (w, h) and (x, y), generate a haystack composed ...
26
votes
11answers
3k views

Rational Number RNG

The Objective Build a random number generator whose range is \$\left[0,1\right) \cap \mathbb{Q} .\$ This is, build a random number generator that can produce any value that's: at least \$0 \,;\$ ...
1
vote
15answers
372 views

type in a random mess of capital letters [duplicate]

SOMe PEOPle lIkE tO TYpE iN A LoGiCAL MAnNER, WITh CapITals aT tHe bEGiNnIng Of ThE SENtENCE and smaLl LETTErS EVeRYWHErE eLsE. NOT Us. NOt Us. Your joB iS to tAkE A SenTEncE Of A LL SMAlL LeTTeRS, ...
-8
votes
1answer
346 views

Don't get banned from stack exchange! [closed]

I'm sure this is going to spark some controversy, but let's do a practical demonstration. The objective of this is simple, using the new code of conduct and no input, print out my pronouns ( "he/him"...
1
vote
1answer
218 views

Number of characters skipped determines code printed [closed]

Write a program which, when every nth character is skipped, it prints n. For example, if every 2nd character is skipped, it prints 2. Example n=0 foobar Output:...
7
votes
3answers
428 views

Draw the flag of Tennessee

The flag of Tennessee is specified by chapter 498 of the Public Acts of 1905. An oblong flag or banner in length one and two thirds times its width, the large or principal field of same to be of ...
29
votes
12answers
5k views

Mutate my DNA sequence

When translating DNA into proteins, the ribosomes read the sequence of DNA nucleotides 3 by 3. Each set of 3 nucleotides is called a codon, and each codon encodes for an amino acid, with some ...
10
votes
7answers
433 views

A Change in Perspective

In this challenge you will write a piece of text which when viewed from two different angles will create two different programs. Your string as viewed from above must take a string containing only ...
15
votes
2answers
1k views

ASCII TURNED SHAPE

How can we depict a turned shape simply and nicely using ascii characters in 3D space? I suggest this method : Instead of a circle we use a square rotated by 45° for the cutting section so that we ...
32
votes
20answers
3k views

Length-terminated sequences

We all know the age-old debate - should strings be length-prefixed or should they be null-terminated? Well, you've run into a blob of binary data and apparently whoever made it decided that the best ...
25
votes
9answers
3k views

Implement the 2D Hadamard Transform

The Hadamard transform works similarly to the Fourier transform: it takes a vector and maps it to its frequency components, which are the Walsh functions. Instead of sine waves in the Fourier ...
14
votes
4answers
471 views

List where pinballs would exit a grid of bumpers from different entrance points

Inspired by this lumosity mini game, Pinball Recall We start with a rectangular grid (viewed from above) with several bumpers as follows. Entrances/exits are numbered counter-clockwise starting from ...
5
votes
6answers
260 views

Explore a Klarner-Rado sequence [duplicate]

One of the Klarner-Rado sequences is defined as follows: the first term is \$1\$ for all subsequent terms, the following rule applies: if \$x\$ is present, so are \$2x+1\$ and \$3x+1\$ the sequence ...
18
votes
25answers
4k views

Visualize a large int

Convert a large int (e. g. 1234567890) into a string containing the usual decimal prefixes k, M, G, T, etc. for kilo, mega, giga, tera, etc. The result shall be groups of three digits, interspersed ...
13
votes
0answers
358 views

Gerrymander North Carolina

The challenge How well can you gerrymander North Carolina into 13 voting districts? In this challenge, you use the following files to draw different maps for Republicans and Democrats. File 1: ...
24
votes
14answers
3k views

Are my triangles similar?

Given (in any structure; flat list, two lists of lists, a tuple of matrices, a 3D array, complex numbers,…) the coordinates for two non-degenerate triangles ...
10
votes
8answers
2k views

Russian Caesar cipher

The objective Given a Russian text, encrypt it with Caesar cipher with key 16. The basic Cyrillic alphabets The basic Cyrillic alphabets are: (U+0410 – U+042F) ...
5
votes
6answers
498 views

Implement the named labels for assembly

Let's assume we've got an imaginary assembler. The assembler supports numerical labels. An infinite loop example: :1 jmp 1 Your task is, to write a ...
15
votes
10answers
1k views

Digit Date Range

NOTE: Since I'm Dutch myself, all dates are in the Dutch dd-MM-yyyy format in the challenge description and test cases. Challenge: Inputs: Start date \$s\$; End ...
3
votes
2answers
217 views

Tips for golfing in MathGolf

What general tips do you have for golfing in MathGolf? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to MathGolf (for tips which can be ...
13
votes
5answers
500 views

Typing, but to the left [closed]

Background You've been given a task to take notes for a meeting. You start typing on your Google Doc, but you don't have enough time during the meeting to look at your keyboard while you type. ...
7
votes
0answers
128 views

Make Korean Character Multi-style Ascii/Box Art

About Hangul As I'm Korean, I'm really proud of Korean character, Hangul(한글). Hangul is artificial character made by King Sejong the great, 4th king of Joseon dynasty, at 1443. Because today(...
17
votes
2answers
561 views

Number of distinct tilings of an n X n square with free n-polyominoes

The newest "nice" OEIS sequence, A328020, was just published a few minutes ago. Number of distinct tilings of an n X n square with free n-polyominoes. This sequence counts tilings up to symmetries ...
8
votes
1answer
583 views

Compute OEIS A161169, approximately and quickly

\$T(n, k)\$ gives the number of permutations of length \$n\$ with up to \$k\$ inversions. This values grows very quickly, for example for \$T(20, 100) = 1551417550117463564\$. The maximum number of ...
24
votes
10answers
2k views

Fermat's polygonal number theorem

Fermat's polygonal number theorem states that every positive integer can be expressed as the sum of at most \$n\$ \$n\$-gonal numbers. This means that every positive integer can be expressed as the ...
20
votes
20answers
5k views

Code Golf Measurer © 2019

Code Golf Measurer © 2019 Hexdumps used with xxd look something like this: ...
-11
votes
7answers
298 views

The null challenge: do nothing [closed]

Write the shortest possible program or function in your language that does nothing. Specifically, it must take no input or ignore its input, and must not produce any output in any legal output method ...
9
votes
3answers
367 views

North Korean dictionary order

The objective Given a string of Hangul syllables, sort the characters in North Korean dictionary order. Introduction to Hangul syllables Hangul(한글) is the Korean writing system invented by Sejong ...
15
votes
5answers
2k views

What's the current zodiac?

Display the emoji of the eastern zodiac of given time, according to given country. The eastern zodiac is a classification scheme that assigns an animal and its reputed attributes to each year in a ...
20
votes
7answers
2k views

Diamondize Some Text

Given an input string of length 2 or longer consisting solely of alphabetical characters [A-Z] or ...
7
votes
2answers
237 views

Is this skew symmetry?

In this challenge, your task is to detect (vertical) Skewer Symmetry. This means that one half of the pattern can be produced by mirroring the other half along a vertical axis, and then moving it ...
6
votes
7answers
475 views

C4_4 Reflection!

In this challenge, your task is to input a rectangle ASCII pattern (You may assume only printable characters need to be handled, and you may assume a trailing newline or not), C4_4 symmetrify, and ...
9
votes
19answers
3k views

Shortest way to get an EOF Error [closed]

It's simple, simply output text to STDERR containing the string EOF. Input/Output Your input will be none; however, you should output the message to STDERR. ...
1
vote
0answers
49 views

Spreadsheet Columns [duplicate]

Spreadsheet Columns In most spreadsheet programs, columns go A, B, C, ... ...
24
votes
23answers
4k views

Fill a bowl with alphabet soup

We seem to never get tired of alphabet-related challenges... The recipe Given a string of letters S, and two positive integers ...
7
votes
3answers
393 views

CUT OUT HEXAGONS

Write a full program or a function taking an unsigned integer number N and doing this cut out work: Cut out a hollow hexagon 'donut' shape with side B-C equal to 2N times '/' Translate the piece ...
16
votes
6answers
955 views

From Plate to State

This is essentially the inverse of Generate a US License Plate Challenge: Given a string that matches one of the below license plate formats, output all possible states that match that formatting. In ...
24
votes
25answers
3k views

Print the sequence

21, 21, 23, 20, 5, 25, 31, 24, ? Inspired by this Puzzle, given an integer \$n>0\$ , print out the following sequence until you reach a non-Integer (spoilered, in case you want to solve the puzzle ...
2
votes
0answers
139 views

Test the endianness

Given a UTF-16 string, test its endianness. Rules: As long as the input is in UTF-16 without BOM, its type doesn't matter. In C++ on Windows, it can be ...
11
votes
24answers
3k views

Little Endian Number to String Conversion

Introduction During work with BMP (bitmap) generator I face problem of converting number to little endian hex string. Here is function which I create in JavaScript - but wonder how small code can ...
6
votes
2answers
312 views

BLUEREDGOLDEGGSFEATHERSFEATHERS

There's a little-known secret in Banjo-Kazooie that you can interleave the three Cheato codes on the Treasure Trove Cove Sandcastle floor and it will still recognize all of them. So you could, for ...
11
votes
9answers
2k views

Postman Delivery

I just got a job as a postman and I need your help to keep it. I have to order a lot of mails before I go out to deliver them. Streets are numbered strictly sequentially, starting with 1 at the start ...
10
votes
2answers
793 views

Find the largest root of a polynomial with a neural network

The challenge Find the smallest feedforward neural network such that, given any 3-dimensional input vector \$(a,b,c)\$ with integer entries in \$[-10,10]\$, the network outputs the largest (i.e., "...
2
votes
1answer
87 views

Decode a UTF-8 string to character byte counts [duplicate]

Given a UTF-8 string, give a string that represents byte counts of each characters. Rules: As long as the input string is encoded in UTF-8 (without BOM), its type doesn't matter. In C++, it can be <...
15
votes
43answers
3k views

Find the percentage

We haven't had any nice, easy challenges in a while, so here we go. Given a list of integers each greater than \$0\$ and an index as input, output the percentage of the item at the given index of the ...
0
votes
0answers
96 views

Write a piece of code that prints out itself [duplicate]

I'm new to this site, so I don't know whether this challenge already appeared: Write a piece of source code, so that after running the code, it prints out exactly (i.e. not longer, not shorter) the ...
13
votes
28answers
2k views

Injection from two strings to one string

Challenge Write a program that applies an injective function which takes an ordered pair of strings as input and one string as output. In other words, each input must map to a unique output. ...
4
votes
7answers
158 views

Replace by most recent nonzero [duplicate]

Given a non-empty list of decimal digits (0, 1, ..., 9), replace each zero by the most ...

15 30 50 per page