instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Choose a challenge from the Cops thread, determine the third hidden message, and describe how the system works.
Keep in mind limitations and possibilities available to Cops:
You are not expected to guess any cryptographic secrets or additional information required to extract the hidden messages, as they should have al... | stackexchange_codegolf |
Introduction
I've always liked the idea of finding the most possible bang-for-your-buck squeezed out of a tiny chip, like the 6502. Of course, I'll need to start small. Filling the screen on 6502asm.com should be easy enough.
Challenge
Fill the entire program output screen on 6502asm.com with the color white using the ... | stackexchange_codegolf |
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 need in order to have a sound train.
Task
Given the sequence of function arities in the train, determine if the train is va... | stackexchange_codegolf |
There are 5 different "special characters": % & # $ !
These special characters are in a string with numbers. Like so: "5 ! 60%2$5.3" (valid). You must determine the validity of the string and there are certain rules in order to determine validity of the string.
Rules:
These special characters can exist in a string... | stackexchange_codegolf |
At the Code-Golf™ Psychological Society, you are delighted to present a new method of measuring mental age: Abstract Capacity™.
To get the Abstract Capacity of a person, you take their actual age divided by 4, take their IQ divided by 9, then add the two values together. Then, round this sum down to find the Abstract C... | stackexchange_codegolf |
What your function must do:
be as short (in bytes) as possible
take 3 inputs that are strings: number , fromdigits, todigits
assume no digit is repeated in fromdigits or todigits
assume fromdigit and todigit contain only alphanumeric characters
assume number is a natural number
output (a string): number converted to fr... | stackexchange_codegolf |
Objective
Given an integer \$n\$ interpreted as two's complement binary, output two integers, namely the integer consisting of \$n\$'s bits at places of \$2^0, 2^2, 2^4, \cdots\$, and the integer consisting of \$n\$'s bits at places of \$2^1, 2^3, 2^5, \cdots\$.
Note that the input may be negative. Since \$n\$ is inter... | stackexchange_codegolf |
I came across this picture, which I initially questioned and thought about posting to Skeptics. Then I thought they'll only tell me if this one case is true, but wouldn't it be great to know how true any "rule" really is? Today you're going program a skeptic-bot
Challenge
Write a program or function which when given a ... | stackexchange_codegolf |
Take a positive integer X. This number is part of the sequence we are interested in if the sum of all digits of X is a divisor of X, and if the product of all digits of X is a divisor of X.
For example, 135 is such a number because 1 + 3 + 5 = 9 which divides 135 = 9 * 15 and 1 * 3 * 5 = 15 which also divides 135.
This... | stackexchange_codegolf |
Definition: a prime power is a natural number that can be expressed in the form pn where p is a prime and n is a natural number.
Task: Given a prime power pn > 1, return the prime p.
Testcases:
input output
9 3
16 2
343 7
2687 2687
59049 3
Scoring: This is code-golf. Shortest answer in bytes wins.
| stackexchange_codegolf |
Inspired by a bug in a solution to this challenge, your challenge is to produce this exact text:
ZYXWVUTSRQPONMLKJIHGFEDCBA
YXWVUTSRQPONMLKJIHGFEDCBA
XWVUTSRQPONMLKJIHGFEDCBA
WVUTSRQPONMLKJIHGFEDCBA
VUTSRQ... | stackexchange_codegolf |
(Note: although related, this challenge is not a duplicate of this one because it requires determining leap seconds automatically rather than hardcoding their times, and is not a duplicate of this one because most of the difficulty comes from determining the time without leap second skewing, something that most time A... | stackexchange_codegolf |
You just recently got a new phone, but you don't quite like the way it vibrates, you've decided you want to create your own vibration patterns. So, you've written a program where you used the keywords long, short and pause to make your phone vibrate according to these keywords.
Task
Create a small program that accepts ... | stackexchange_codegolf |
You must generate an text stereogram according to an input string containing a paragraph of text, an empty line then the hidden message.
The result will be displayed as a pair of paragraphs, one with different spacing causing the effect of it being raised up when viewed stereographically (An explanation can be found he... | stackexchange_codegolf |
Mr Short likes to play chess. Mr Short is also a very traditional man. Hence, Mr Short is disturbed by the recent trend of using Algebraic notation in modern chess, and he would rather use Descriptive notation, like his father and his father's father before him.
Note
To simplify this challenge, I chose not to deal with... | stackexchange_codegolf |
Given a positive integer \$N >= 4\$, output an RSA key pair (both the private and the public key) whose key length is \$N\$ bits.
The RSA key generation algorithm is as follows:
Choose an \$N\$-bit semiprime \$n\$. Let the prime factors of \$n\$ be \$p\$ and \$q\$.
Compute \$\lambda(n) = LCM(p-1, q-1)\$.
Choose an int... | stackexchange_codegolf |
Task
Write a polyglot in two languages that when run, outputs the name of the language it is run in. Additionally, this program must also output the other language's name if the source code is reversed
Example:
Program ABC in language foo outputs foo. ABC in language bar outputs bar. CBA in language foo outputs bar, an... | stackexchange_codegolf |
Write an interactive program or function which allows the user to play The Coinflip Game! The object of the game is to repeatedly flip a coin until you get the same result \$n\$ times in a row.
Specific behavior of the program/function is as follows:
At the start of the game, the user inputs a positive integer \$n>1\$... | stackexchange_codegolf |
My electric garage door works like this:
There is just one push button to control the door
If the door is fully closed and I hit the button, the door starts to open. It takes 10 seconds to open fully
If the door is fully open and I hit the button, the door starts to close. It takes 10 seconds to close fully
If the d... | stackexchange_codegolf |
This challenge is a simple ASCII-art challenge inspired by the solar eclipse that happened on August 21, 2017. Given an input 0 <= n <= 4, output the corresponding stage of the eclipse described below:
n=0:
*****
** **
* *
* *
** **
*******
n=1:
*****
** *****
* *******
* *****... | stackexchange_codegolf |
Background
So, nowadays the popular Prisoner's Dilemma variant is the Prisoner's Trilemma, where there are three options. I can easily see that being increased, so I figured
Why settle for three options, when we can have INFINITE options?
Therefore, I created the Floating Point Prisoner's ?Lemma.
Equations:
Each roun... | stackexchange_codegolf |
You're driving a car in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose whether to continue left, right, or straight. A sequence of choices that returns you to your initial state (street segment and direction) is called... | stackexchange_codegolf |
Let's have a ragged list containing no values, only more lists. For example:
[[[],[[]],[],[]],[],[[],[],[]],[]]
And the list will be finite, meaning that eventually every path terminates in an empty list [].
It's simple enough to determine if two of these are structurally equal. Check each element in order for equali... | stackexchange_codegolf |
Balanced binary search trees are essential to guarantee O(log n) lookups (or similar operations). In a dynamic environment where a lot of keys are randomly inserted and/or deleted, trees might degenerate to linked lists which are horrible for lookups. Thus there are various kinds of self-balancing binary trees that cou... | stackexchange_codegolf |
Given an ASCII art with simple closed paths using | and - (pipes and dashes), output a random point inside the boundary.
Eg. given:
---- ----
| |- --- => |12|- ---
| | | | |345| |6|
----- --- ----- ---
Any point 1-6 should have an equal probability of being printed.
Specs
T... | stackexchange_codegolf |
Background
MQTT (Message Queuing Telemetry Transport) is an ISO standard publish-subscribe-based messaging protocol (Wikipedia).
Each message has a topic, such as the following examples:
myhome/groundfloor/livingroom/temperature
USA/California/San Francisco/Silicon Valley
5ff4a2ce-e485-40f4-826c-b1a5d81be9b6/status
Ge... | stackexchange_codegolf |
Background
Perfect shuffle algorithms like Fisher-Yates shuffle don't produce great results when it comes to music playlist shuffling, because it often produces clusters of songs from the same album. In an attempt to solve this problem, Spotify introduced an interesting shuffle algorithm in 2014. At the end of the arti... | stackexchange_codegolf |
I'm one of the authors of Gimli. We already have a 2-tweet (280 chars) version in C but I would like to see how small it can get.
Gimli (paper,website) is a high speed with high security level cryptographic permutation design that will be presented at the Conference on Cryptographic Hardware and Embedded Systems (CHES)... | stackexchange_codegolf |
Given two integers greater than one, A and B, output four mathematical expressions in this order:
The plain expression A^B (A to the power B). e.g. if A = 2 and B = 3, 2^3.
The expansion of A^B in terms of repeated multiplications of A. e.g. 2*2*2.
The expansion of A^B in terms of repeated additions of A. e.g. 2+2+2... | stackexchange_codegolf |
Inspired by a challenge from the OUCC 2022 Seniors competition.
Background
Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing team's flag in the shortest amount of time. The attacking players each have one soft ball they can throw at the defenders. Teams ge... | stackexchange_codegolf |
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: NC_2016_presidential_election.csv
File 2: NC_county_adjacency.csv
File 1 gives county-level voting data from the 2016 president... | stackexchange_codegolf |
Sometimes lexicographical sorting of strings may cut it, but when browsing the filesystem, you really need better sorting criteria than just ASCII indices all the time.
For this challenge, given a list of strings representing filenames and folders in a directory, do a filesystem sort, explained below:
Split every stri... | stackexchange_codegolf |
A quote from MO.SE answer:
Although it is well known that Conway was able to quickly calculate the day of the week of any given date, it is less well known that one part of the algorithm is easy to remember and useful in practice: In any given year, the following dates all fall on the same day of the week: 4/4, 6/6, 8... | stackexchange_codegolf |
Mathemania Specs:
Every piece of Mathemania code starts off with the number 2. From the 2, you can do the following operations:
e: Exponentiation. This command's default is squaring the number.
f: Factorial. This command's default is using the single factorial on the number (using f on 2 = 2! = 2).
r: Root. This comma... | stackexchange_codegolf |
Write a function which takes n as a parameter, and returns the number of trailing zeros in n!.
Input Constraints
0 <= n <= 10^100
Output Constraints
Should be return the result in less than 10 seconds.
Test Input
1
213
45678
1234567
78943533
4567894123
121233112233112231233112323123
Test Output
0
51
11416
308638
19735... | stackexchange_codegolf |
The Juggler sequence is described as follows. Beginning with an input \$a_1\$, the next term is defined by the recurrence relation
$$a_{k+1} = \begin{cases}
\left\lfloor a_k ^ \frac 1 2 \right\rfloor,\text{ if } a_k \text{ is even} \\
\left\lfloor a_k ^ \frac 3 2 \right\rfloor,\text{ if } a_k \text{ is odd} \\
\end{cas... | stackexchange_codegolf |
Task
Given an image with a line on it, produce or display an image with the line extended till the edge of image. The line is black and the background is white. The image size is 100x100 The image comes in any reasonable format (e.g. jpg, png, ppm, bmp).
Line format
I'm using a simplified version of Bresenham's line al... | stackexchange_codegolf |
A histogram is an array of integers that counts the number of times a symbol occurs. For example, for the string "aaabbbabbdebabbbebebdbaaabbabaaaaeebeaabaaba" a histogram is a: 18, b: 18, c: 0, d: 2, e: 6, or [18, 18, 0, 2, 6] in short.
If we were to pick a random character out of this string, what would the chance be... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2017 Day 3, Part 2.
You come across an experimental new kind of memory stored on an infinite two-dimensional grid.
Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up wh... | stackexchange_codegolf |
Introduction
Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers.
The first challenge in this series is to output a(n) for a given n as input, where a(n) is A064413, also known as the EK... | stackexchange_codegolf |
An even distribution number is a number such that if you select any of it's digits at random the probability of it being any particular value (e.g. 0 or 6) is the same, \$\frac1{10}\$. A precise definition is given later on.
Here are a few examples:
\$\frac{137174210}{1111111111} =0.\overline{1234567890}\$ is an even... | stackexchange_codegolf |
I recently solved a coding challenge in one of the challenge papers that my IT teacher gave to us. It was a seemingly simple, but fun challenge, so I thought it will make fun golfing.
The task
Given an input of a 2x2 matrix that contains 4 strictly positive integers (i.e. non-negative and non-zero), like this:
$$\begin... | stackexchange_codegolf |
Notation and definitions
Let \$[n] = \{1, 2, ..., n\}\$ denote the set of the first \$n\$ positive integers.
A polygonal chain is a collection of connected line segments.
The corner set of a polygonal chain is a collection of points which are the endpoints of one or more of the line segments of the chain.
Challenge
T... | stackexchange_codegolf |
The Challenge
Given a non-empty string containing only lowercase or uppercase letters and no spaces:
Sum up the ASCII values for each character instance in the input string.
The sum will be converted to binary.
And, the result will be the number of ones in the binary value.
Input example:
abcDeFAaB
Sum up the ASCII... | stackexchange_codegolf |
This is a very simple challenge, and it is to print the numbers -1, 0, and 1.
The following paragraph is credited to Print numbers from 1 to 10
Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of those, etc., but no digits), and pr... | stackexchange_codegolf |
This is similar to Making an acronym, but there are several key differences, including the method of fetching the acronym, and this challenge including flexible output.
Task
Given a string (list of chars/length 1 strings is allowed) containing only printable ASCII, output all capital letters in the input that are eithe... | stackexchange_codegolf |
This idea came to me when I saw my little brother playing with my calculator :D
The task
Taking a integer as an input, print that many graphical square roots under each other, like this:
n = 1
___
\/ 1
n = 3
_______
/ _____
/ / ___
\/\/\/ 3
n = 5
___________
/ _________
/ / _______
/ ... | stackexchange_codegolf |
Context
We're at war! You need to transfer an important message to your general to inform them from an imminent assault. The thing is, your enemy knows a lot about cryptography : you will need to be more creative in order to encode your message...
Task
Create a program that accepts an ascii message as input, and output... | stackexchange_codegolf |
Your task is to solve a new puzzle called Cubax. This toy is actually a Chinese puzzle whose expected “final” state is a simple cube. During the festivities, Cubax unfolded, because it cannot move when folded.
Cubax is composed of N³ smaller cubes (elements) linked together in a kind of doubly linked chain. The chain h... | stackexchange_codegolf |
Related but different.
Part II
Taken from the book: Marvin Minsky 1967 – Computation:
Finite and Infinite Machines, chapter 14.
Background
As the Gödel proved, it is possible to encode with a unique positive integer not just any string
but any list structure, with any level of nesting.
Procedure of encoding \$G(x)\$ i... | stackexchange_codegolf |
Your task
Given a string of lowercase letters, output the "alphabet checksum" of that string, as a letter.
Example
Let's say we have the string "helloworld". With a = 0, b = 1, c = 2 ... z = 25, we can replace all of the letters with numbers:
h e l l o w o r l d
7 4 11 11 14 22 14 17 11 3
Now, we can sum th... | stackexchange_codegolf |
Let me know if this task has already been posed. I haven't found it when I looked.
Input
master sequence \$\ X = x_1\dots x_n\$: sequence of characters, eg. \$\rm international\$
subsequence \$\ Y = y_1\dots y_m\$: sequence of characters, eg. \$\rm intl\$
Output
Number of possible mappings \$\mu: [1\dots m] \righta... | stackexchange_codegolf |
Challenge
The goal of this challenge is to make a function that takes an input string, a start keyword and a end keyword. The output extracted result is from (but excluded) the given start keyword to (but excluded) end keyword. The output sub-string follows the rules as below.
In all cases, the leading/trailing spaces... | stackexchange_codegolf |
Inspired by this Numberphile entry
Background
The cube distance numbers of an integer n are defined here as the set of integers that are x³ distance away for a given x. For a simple example, with n=100 and x=2, the cube distance numbers are {92,108}.
This can be extended into a larger set simply by varying x. With x ∈ ... | stackexchange_codegolf |
Given a non-empty list L of integers greater than 1, we define d(L) as the smallest positive integer such that n + d(L) is composite for each n in L.
We define the sequence an as:
a0 = 2
ai+1 is the smallest integer greater than ai such that d(a0, ..., ai, ai+1) > d(a0, ..., ai)
Your task
You may either:
Take an in... | stackexchange_codegolf |
On the TV cooking show Guy's Grocery Games, the chefs cannot begin shopping until Guy Fieri, the show's host, says "Three, two, one, go!" However, the words do not have to be all together. He often "hides" the words in things like this (based on a real example, but not quoting verbatim):
There are three of you here; a... | stackexchange_codegolf |
Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line.
So the end-result becomes:
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
ooooooo... | stackexchange_codegolf |
Daylight saving time (DST), is the practice of advancing clocks (typically by one hour) during warmer months so that darkness falls at a later clock time. The typical implementation of DST is to set clocks forward by one hour in the spring ("spring forward") and set clocks back by one hour in autumn ("fall back") to re... | stackexchange_codegolf |
Introduction
Briscola is one of Italy's most popular card games. It is a trick-taking card game, like Bridge. Briscola is well known for its bizarre point system. In this challenge, given two cards, you will output whether the first one scores more, less, or the same number of points as the second in Briscola's point s... | stackexchange_codegolf |
Given a random coordinate (x,y), determine in which square (squares are referenced by their sidelength) it is (or the borders of which squares).
The squares are drawn in a counter clockwise direction, that is, the first square is drawn in the first quadrant, the one after is to the right, the one after that above, th... | stackexchange_codegolf |
Sandbox
The major scale (or Ionian scale) is one of the most commonly used musical scales, especially in Western music. It is one of the diatonic scales. Like many musical scales, it is made up of seven notes: the eighth duplicates the first at double its frequency so that it is called a higher octave of the same note.... | stackexchange_codegolf |
Show the random result of a dice toss if done with a cube shaped die, in ASCII.
$ dice
should result in one of
-----
| |
| o |
| |
-----
-----
|o |
| |
| o|
-----
-----
|o |
| o |
| o|
-----
-----
|o o|
| |
|o o|
-----
-----
|o o|
| o |
|o o|
-----
-----
|o o|
|o o|
|o o|
-----
| stackexchange_codegolf |
Print the following text and nothing else:
<html>
<body>
<p>HTML is kinda annoying</p>
</body>
</html>
I'm happy I'm not a web developer.
The catch? Your code must fit the template: print(<?>), where ? can be any group of characters. You can paste your completed code (with the print(<>) part) into this Scast... | stackexchange_codegolf |
A ragged matrix, is a matrix that has a different number of elements in each row. Your challenge is to write a program in any favorable language to find the indices of all occurrences of target in the ragged matrix.
Input:
A list of ragged lists (can be empty) of positive integers and a target range e.g. 26-56. The tar... | stackexchange_codegolf |
I recently moved to an apartment overlooking the inner ring-road of town, and every day, a beautiful scene unfolds. The traffic lights are apparently so confusing (mostly because the Dutch are used to complex intersections, and this one is too simple for them to wrap their heads around), that the intersection invariabl... | stackexchange_codegolf |
Introduction
Sisyphus was having some troubles at work lately. It seems he just never gets anything done, and he would love to find a solution to this problem.
His current employment requires rolling a rock up a hill. He usually does his job well, but every time he is near the top of the hill it rolls down again.
He is... | stackexchange_codegolf |
As a little joke in the office someone wanted a script that randomly picks a name, and said person will make a round of drinks.
Let's call the people John, Jeff, Emma, Steve and Julie.
I thought it would be funny to make a script that seems random at a quick glance, but actually always gives the same person as the out... | stackexchange_codegolf |
The challenge below requires you to be familiar with formal parser theory. If you don't know what the question is asking because you don't know what the terms mean, context-free grammars and first/follow sets are covered in a lot of university courses.
I can recommend this Stanford course, in particular handouts 08 and... | stackexchange_codegolf |
It is the year 87,539,319 and solitary space-walking is now commonplace, many people travel into space by themselves, propelled by nothing but a jetpack on their backs, programming their course with a personal computer and keyboard as they go.
You are one such person; you were out on a lovely, peaceful spacewalk, when,... | stackexchange_codegolf |
An activity I sometimes do when I'm bored is to write a couple of characters in matching pairs. I then draw lines (over the tops never below) to connect these characters. For example I might write \$abcbac\$ and then I would draw the lines as:
Or I might write \$abbcac\$
Once I've drawn these lines I try to draw cl... | stackexchange_codegolf |
You are to take a string representing a piece of brainfuck code and Explanations, containing only printable ASCII characters and newlines ( to ~, ASCII 10 and 32 to 126) as input and output an explanation of that code, formatted to be compliant with Stack Exchange markdown.
That is, the explanation must satisfy:
Each... | stackexchange_codegolf |
Task
Using any type of parallelisation, wait multiple periods, for a total sleep time of at least a minute (but less than a minute and a half).
The program/function must terminate within 10 seconds and return (by any means and in any format) two values: the total elapsed time, and the total executed sleep time. Both ti... | stackexchange_codegolf |
Modern mathematics has been formalised using set theory by various systems of axioms. Zermelo Frankel set theory with the axiom of choice (ZFC) forms an intuitive set of axioms and is hence most popular, though stronger choices exist.
Inspiration: A Relatively Small Turing Machine Whose Behavior Is Independent
of Set T... | stackexchange_codegolf |
Introduction
Everyone should know IPv6 by now. IPv6 has very long, cumbersome addresses.
In 1996 some very intelligent people created a scheme to encode them much better in RFC 1924. For reasons I cannot understand, this hasn't been widely adopted. To help adoption, it is your task to implement a converter in the langu... | stackexchange_codegolf |
Duplicate? I knew somebody must've done this before.
Programming a programming language in itself is something that has interested me since I knew what a programming language was. So I thought I'd create a Code Golf challenge for you.
Challenge
Create an interpreter for a given programming language, programmed entirel... | stackexchange_codegolf |
Consider a stream/file with one integer per line. For example:
123
5
99
Your code should output the sum of these numbers, that is 227.
The input format is strictly one integer per line. You cannot, for example, assume the input is on one line as an array of integers.
You can take input either from STDIN, in form of a ... | stackexchange_codegolf |
What general tips do you have for golfing in Chef? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Chef (e.g. "remove unnecessary whitespace" is not an answer).
Please post one tip per answer.
| stackexchange_codegolf |
Take a string, s containing printable ASCII-characters as input, and output its "binary split sum". Need an explanation?
How do you get the binary split sum?
We'll use the string A4 as an example in the following explanation.
Convert the characters to binary, treating each letters as a 7-bit ASCII character
A -> ASCII... | stackexchange_codegolf |
Input:
A decimal
Output:
The input truncated
How to truncate them?
The integer part of the input will remain the same. The decimal part of the input will be truncated based on the lowest digit in consecutive order. The two step-by-step examples below should clarify what I mean by that:
Example 1: Input: 17.46940822
Ste... | stackexchange_codegolf |
You are given an array A of length N and an array B of length N-1.
You need to output array where items alternates:
A[0], B[0], A[1], B[1], ..., B[N-2], A[N-1]
Restrictions:
N>0
Type of items is not specified, but code should work at least for unsigned integers.
Sample input:
A = [1,2,3,4]
B = [7,8,9]
Sample output:... | stackexchange_codegolf |
For the purposes of this challenge, let's define a cyclic number as an integer that passes the basic part of Midy's Theorem, but not necessarily the extended theorem. This means:
the digits in the second half of the repeating decimal period are [integer is] the 9s complement of the corresponding digits in its first ha... | stackexchange_codegolf |
In this challenge, you get to create a language. Although you have to provide code in other languages, you will only be rated based on the language. Here are the requirements.
You must invent a programming language that is Turing complete.
You will choose a real (as in existed before this question did) language. It mu... | stackexchange_codegolf |
An palindrome is a word that is its own reverse.
Now there are some words that might look like palindromes but are not. For example consider the word sheesh, sheesh is not a palindrome because its reverse is hseehs which is different, however if we consider sh to be a single letter, then it's reverse is sheesh. This... | stackexchange_codegolf |
The following puzzle was invented by Eric Angelini in September 2007.
As mentioned in A131744 :
the sequence is defined by the property that if one writes the English
names for the entries, replaces each letter with its rank in the
alphabet and calculates the absolute values of the differences, one
recovers the sequen... | stackexchange_codegolf |
A simplistic version of English numeral calculator
Task
Write a program that takes a string as input and outputs the result of the expression.
Rules
The input string will be worded and not numeral.
There will be no parentheses.
Order of calculation will be divide,multiply,subtract then add.
For same operations, the cal... | stackexchange_codegolf |
Suppose A and B are two good friends. A has borrowed \$n\$ dollar from B. Now B wants the money back from A and A is also ready to give it. But the problem is A has only \$x\$ dollar notes and B has \$y\$ dollar notes. They both want to keep the number of notes in exchange as low as possible.
As an example if \$n=37\$,... | stackexchange_codegolf |
Given a single digit integer and a three digit integer, output a mathematical formula that uses only the single digit and a given list of operators to equal the three digit integer.
Input: A one digit positive integer (1-9) and a three digit integer (100-999)
Output: A mathematical formula meeting the following requir... | stackexchange_codegolf |
Palindromes are fun, but some of the other strings are starting to feel left out. We can turn those strings into chunky palindromes by splitting them up into palindromic arrays of chunks.
For example, the string "abcabca" isn't a palindrome if we read it character by character, but we have three different ways of makin... | stackexchange_codegolf |
You have a square board with a bunch of items laid out on it in one of a \$3 \times 3\$ grid of cells and you want to lift it up using balloons, but you can only attach balloons to the corners of the board. Your task is to determine the minimum number of balloons in each corner to make sure the board won't tip over in ... | stackexchange_codegolf |
Make a Quine.
Seems easy right? Well this quine must output itself plus its first character, which then outputs itself plus its second character, and so on.
This way the quine should in several generations output two copies.
Example:
Lets your code be x. Running it should output x + x[:1]. Running the resulting program... | stackexchange_codegolf |
Background
An interval graph (Wikipedia, MathWorld, GraphClasses) is an undirected graph derived from a set of intervals on a line. Each vertex represents an interval, and an edge is present between two vertices if the corresponding intervals overlap. The following is an example interval graph with corresponding interv... | stackexchange_codegolf |
Background Information
Inspired by this answer on Arqade SE
Minecraft has rails which allow you to move minecarts around on them for transporting players, entities, and items. There are many types of rails, but today we're only interested in regular rails, which are also the only type that can curve.
When you place dow... | stackexchange_codegolf |
Most of us are probably familiar with the concept of triangular and square numbers. However, there are also pentagonal numbers, hexagonal numbers, septagonal numbers, octagonal numbers, etc. The Nth Nagonal number is defined as the Nth number of the sequence formed with a polygon of N sides. Obviously, N >= 3, as th... | stackexchange_codegolf |
Introduction
The EKG sequence begins with 1 and 2, then the rule is that the next term is the smallest positive integer not already in the sequence and whose common factor with the last term is greater than 1 (they are not coprimes).
The first terms are:
1, 2, 4, 6, 3, 9, 12, 8, 10, 5, 15, ...
It's called EKG because... | stackexchange_codegolf |
Make a program which can fill a 2D space with "pursuit polygons".
The following picture will help you understand better what I mean.
You can also look up "pursuit curves" or mice problem.
You can use any convex n-polygon you like
here are some examples
Triangle:
Square:
Pentagon
notice that for every polygon you ca... | stackexchange_codegolf |
Definitions
A bijection from a set S to a set T is a function from S to T such that one element in T is mapped by exactly one element in S.
A bijection within a set S is a bijection from S to S.
The natural numbers are the integers which are greater than or equal to 0.
A subset of a set S is a set such that every elem... | stackexchange_codegolf |
Two or more positive integers are said to be "friendly" if they have the same "abundancy". The abundancy of an positive integer \$n\$ is defined as $$\frac {\sigma(n)} n,$$ where \$\sigma(n)\$ is the sum of \$n\$'s divsors. For example, the abundancy of \$30\$ is \$\frac {12} 5\$ as
$$\frac {\sigma(30)} {30} = \frac {1... | stackexchange_codegolf |
The Feynman Challenge Cipher #1 is as follows:
MEOTAIHSIBRTEWDGLGKNLANEAINOEEPEYST
NPEUOOEHRONLTIROSDHEOTNPHGAAETOHSZO
TTENTKEPADLYPHEODOWCFORRRNLCUEEEEOP
GMRLHNNDFTOENEALKEHHEATTHNMESCNSHIR
AETDAHLHEMTETRFSWEDOEOENEGFHETAEDGH
RLNNGOAAEOCMTURRSLTDIDOREHNHEHNAYVT
IERHEENECTRNVIOUOEHOTRNWSAYIFSNSHOE
MRTRREUAUUHOHOOHCDCHT... | stackexchange_codegolf |
Choose a set of four bytes without replacement (i.e. no byte repeated), and not necessarily in any particular order, from any one of the following four sets:
The characters of any one single-byte encoding
The Unicode characters in the range 00–FF
The signed decimal integers in the range −128–127
The unsigned decimal i... | stackexchange_codegolf |
Given a positive integer n >= 1, output the first n rows of the following structure:
#
# #
###
# #
# # #
## ##
#####
# #
# # #
# # # #
# ### #
## ##
## # ##
### ###
#######
The n-th 1-indexed row is the binary representation of n, mirrored without copying the last character, with # in place of 1 a... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.