instruction
stringlengths
34
53.1k
Decipher Neurotic Frogs Now that Puzzling.SE has finally cracked my amphibian-obsessed cipher, let's write a program or function to decrypt it! (If you want to look at the puzzle before having it spoiled for you, click the above link now.) How the cipher works In Neurotic Frogs Ought To Relax In Mud Baths ("Neurotic F...
Challenge Given a time and a timezone as input, output the time in that timezone. Time The time will be given in 24 hour format like so: hh:mm Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so: 06:09 All the times given are at UT...
A positive integer n can be represented as a rectangle with integer sides a, b such that n = a * b. That is, the area represents the number. In general, a and b are not unique for a given n. As is well known, a rectangle is specially pleasing to the eye (or is it the brain?) when its sides are in the golden ratio, φ = ...
Challenge: Given a number, take the largest prime strictly less than it, subtract it from this number, do this again to this new number with the biggest prime less than it, and continue doing this until it's less than 3. If it reaches 1, your program should output a truthy value, else, the program should output a false...
Write a program that takes in a number N from 1 to 9 inclusive. In its native form your program should output N+N. E.g. output 2 if N is 1, 4 if N is 2, 6 if N is 3, and so on. When every character in your program is duplicated in place, then it should be a program that takes in N (still from 1 to 9) and outputs N×N. E...
Your task is to, as the title discreetly suggests, make a bad fade animation of one word turning into a second word for yours truly. What exactly is this "fade animation" you may ask? To make a spectacular(ly bad) fade animation, you take two strings which will contain only printable ASCII characters. You start by prin...
Your task is, given a positive integer n, to generate an expression that equals the number n. The catch is: you're only allowed the number 1 in the output. The operators at your disposal are: +, -, * and / / is floating-point division (so 5/2 = 2.5). sqrt (as s) ceil and floor (as c and f respectively) ! (factorial...
Introduciton Some of you might have realised that I am a sloppy typer when using my phone. That's why I want you to write a program which corrects my typos. Chalkrnge Given a misspelled word, output all of the possible words which I meant to write. Typso The main cause of my typos is down to the fact that I hit the wro...
(inspired by this challenge over on Puzzling -- SPOILERS for that puzzle are below, so stop reading here if you want to solve that puzzle on your own!) If a letter in a word occurs alphabetically later than the previous letter in the word, we call that a rise between the two letters. Otherwise, including if it's the sa...
Write a program or function which receives as input a string representing a Welsh word (UTF-8 unless otherwise specified by you). The following are all single letters in Welsh: a, b, c, ch, d, dd, e, f, ff, g, ng, h, i, j, l, ll, m, n, o, p, ph, r, rh, s, t, th, u, w, y To quote Wikipedia, While the digraphs ch, dd,...
Earlier this week, we learned about how to format esoteric languages for commenting. Today, we're going to do the inverse of that. I need you to write a program or function that parses some well-commented esoteric code and parses the comments out, returning just the code. Using some examples from the previous challenge...
Let's use augmented reality to hunt small creatures hidden in source-code. Write a quine program that outputs its own code source, except for 5 consecutive characters that will be modified and that will display a PCG-mon : (^_^) The 5 consecutive characters can be positioned anywhere in the source code (from position 0...
Challenge Given a three digit octal permissions number, output the permissions that it grants. chmod On UNIX OSes file permissions are changed using the chmod command. There are few different ways of using chmod, but the one we will focus on today is using octal permissions. The three digits in the permissions number r...
This is thematically similar to Generate keyboard shortcuts for a menu, but its actually a pretty different challenge. Let's take PHPStorm's menu as an example: New Project New Open Directory Open Open URL New Project from Existing Files Save As Open Recent Close Project Rename Project We need to assign a single-lette...
We define a map as a set of key-value pairs. For this challenge, you need to take each of the values and assign them to a randomly chosen key. You must randomly shuffle the values, and output the resulting map. This means that each time we run your program, we have a chance of getting a different output Each possibl...
This question is written because "Thing Explainer" is fun to read, and gave me an idea. Write "stuff that makes computer do things" that reads/takes a set of letters, numbers and things like this "#%|? and returns True / 1 if all words are part of this set. If all words are not part of that set, return the words that w...
A stem and leaf plot displays a bunch of numerical values in groups, which are determined by all but the last digit. For example, suppose we have this set of data: 0, 2, 12, 13, 13, 15, 16, 20, 29, 43, 49, 101 We could produce this stem and leaf plot: 0|02 1|23356 2|09 3| 4|39 5| 6| 7| 8| 9| 10|1 The first row's stem...
Given a positive integer n and a number a, the n-th tetration of a is defined as a^(a^(a^(...^a))), where ^ denotes exponentiation (or power) and the expression contains the number a exactly n times. In other words, tetration is right-associative iterated exponentiation. For n=4 and a=1.6 the tetration is 1.6^(1.6^(1.6...
Given an integer, output an upside-down tent. The input determines both the size of the tent (absolute value) and whether the entrance is on the left side (negative numbers) or the right side (positive numbers). If input = -1: ____ \/_/ If input = -2: ________ \ / / \/___/ If input = -3: ____________ \ / /...
The Challenge GIFs are the most common image format for animation, and are used pretty heavily in today's social media. For the purpose of this challenge, I'm going to redefine what a GIF can be. This challenge will require you to take in a 3D array containing some sort of representation of a 2D 'image' and iterate thr...
Continued fractions are expressions that describe fractions iteratively. They can be represented graphically: $$ a_0 +\cfrac 1 {a_1 + \cfrac 1 {a_2 + \cfrac 1 {\ddots + \cfrac 1 {a_n} } } } $$ Or they can be represented as a list of values: \$[a_0 ; a_1, a_2, \dots, a_n]\$ The challenge: take a base nu...
The objective is to produce output of n squares (nxn) of random integers (0-9) with a moving * that rotates clockwise around the corners, starting from the top left. The squares should be side by side and separated by a single space. If n = 0, the output should be empty. Output for n=1: * Output for n=2: *3 4* 14 07 O...
Being programmers, watching us flex aren't very interesting. Today we change that! In this challenge you will lex and flex hexaflexagons. About For a video introduction, watch viharts video(s) on flexagons A flexagon is a shape that you can flex to reveal faces other than the top and bottom one; we are making a hexahex...
Here is a relatively simple challenge for you. Given a string of length N, output the string forwards, then backwards, then forwards, then backwards... etc. N times. For example, if your input was Hello! You should output: Hello!!olleHHello!!olleHHello!!olleH You may also optionally output one trailing newline. Your...
In English, there is the fun and simple difference between an and a: you use an when preceding a word starting with a vowel sound, and a when the word starts with a consonant sound. For the sake of simplicity in this challenge, an precedes a word that starts with a vowel (aeiou), and a precedes a word that starts with...
The mid-autumn festival has begun! Unfortunately, all my mooncakes were stolen -- they're getting too expensive for small folk such as myself, and I fear I won't be able to eat any this year! So I turn to you for help. Would you be able to make me some? For those unaware, let me educate you on what a mooncake looks l...
A nice simple one Input Given a boolean array (Or an acceptable alternative), you can assume the array will never be more than 32 elements long. [false, false, true, false, false] Output Invert every element of the array and output it. [true, true, false, true, true] Rules You can write a full program or just a func...
Write a "palipolyquine": a program that is a quine, a polyglot, and a palindrome. Rules: The number of polyglot languages is more preferable than code size. The shortest answer (in bytes) wins, in case of a tie. Polyglot and Quine rules see here: Write a Polyquine. My example (I have a repository Freaky-Sources with...
You sell gold coins. Each gold coin you sell is supposed to be 1 ounce. However, you find out that one of your coin suppliers is cheating you. By alloying the gold material with something else, their coins weigh only 0.9 ounces. With a help of a pointer scale (one that shows the exact weight of a quantity of matter set...
Given a nonempty list of positive decimal integers, output the largest number from the set of numbers with the fewest digits. The input list will not be in any particular order and may contain repeated values. Examples: [1] -> 1 [9] -> 9 [1729] -> 1729 [1, 1] -> 1 [34, 3] -> 3 [38, 39] -> 39 [409, 12, 13] -> 13 [11, 11...
Write a program or function which will provably print all integers exactly once given infinite time and memory. Possible outputs could be: 0, 1, -1, 2, -2, 3, -3, 4, -4, … 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9, 10, 11, … This is not a valid output, as this would never enumerate negative num...
Briefing Aliens have settled on earth and strangely enough, their alphabet is the exact same as ours. Their language is also very similar to ours with some very distinct and easy to compute differences. Challenge Take a string and output the alien's language equivalent. The translation works as such: Swap all the vowel...
This challenge is inspired from this answer at the Ask Ubuntu Stack Exchange. Intro Remember the Windows ME screensaver with the pipes? Time to bring the nostalgia back! Challenge You should write a program or function which will output an ASCII representation of the screensaver. In the screensaver there should be a...
Intro In J. R. R. Tolkien's Lord of the Rings, this phrase is on the cover of each book. Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone, Nine for Mortal Men doomed to die, One for the Dark Lord on his dark throne In the Land of Mordor where the Shadows lie. One Ring to...
Challenge Given a number x and a number n, round number x to n significant figures and output the result. Significant figures The significant figures of a number are digits that carry meaning contributing to its measurement resolution. This includes all numbers except leading zeroes. Bear in mind that leading zeroes af...
There exists an equation, assuming n and x are positive, that expresses the relationship between two monomials, one being a common misrepresentation of the other. Many people make the simple mistake of equating these (i.e. 3x^2 and (3x)^2). Challenge Given a positive integer, i, determine and return the solution n and...
Challenge Given an input n, print an ASCII art cake n layers tall, viewed from the side, with two candles on top. Refer to the examples below for details. Output >> cake(1) _|_|_ | | +-----+ >> cake(3) _|_|_ | | +---------+ | | +-------------+ | | +-------------+ ...and so ...
Challenge Given an input of an all-lowercase string [a-z], output the total distance between the letters. Example Input: golf Distance from g to o : 8 Distance from o to l : 3 Distance from l to f : 6 Output: 17 Rules Standard loopholes forbidden This is code-golf - shortest answer in bytes wins. The alphabet can b...
This challenge is the first in a two-challenge series about Repetition. The second will be up soon. In a language called Repetition (something I just made up), there consists an infinite string of 12345678901234567890..., with 1234567890 repeating forever. The following syntax is available to output numbers: +-*/: Thi...
The House of Santa Claus Note: This is the first challenge that I have attempted to set. It has been through the Sandbox however if you find something wrong with it please do not just downvote but leave a comment so that I can improve it. Background There is a old childrens puzzle where the challenge is to draw a box w...
Write a program or function that prints or outputs this exact text (consisting of 142 characters): ()()()()()() |\3.1415926| |:\53589793| \::\2384626| \::\433832| \::\79502| \::\8841| \::\971| \::\69| \::\3| \__\| Your program must take no input (except in languages where this is impossible...
One of the cool features introduced in the C++11 standard is the ability to declare a template parameter as being variadic; i.e. that parameter represents a sequence of an arbitrary number of arguments (including zero!). For example, suppose the parameter pack args expands contains the sequence A0, A1, A2. To expand th...
I was looking at my previous challenge and thought I could make a better version, but I didn't want to modify that one, so here it is! Challenge Given an input n, print an ASCII art cake n layers tall, viewed from the side, with two candles on top, using box drawing characters. First layer is thinner than the other...
Inpsired by a youtube video from a fellow PPCG user... You challenge is to use ASCII-art draw a Minecraft castle wall of Andesite and Diorite. The shape of the wall is the Cantor Set. For reference, the Cantor Set is made by repeating the following N times: Triple the current step Replace the middle one with blank spa...
Challenge The challenge is to write a function that prints the number of repeats a given array of integers has. What are repeats? Repeats of a slice (as in a section of an array) [ a1, a2, a3, ..., an] are any other non-overlapping slices of the forms [ a1+an, a2+an, a3+an, ..., an+an], [ a1+2an, a2+2an, a3+2an, ..., a...
Take two lists of non-negative integers, and output an ASCII-box as it's defined below. Corners and intersections are pluses: + (ASCII-code 43) Vertical lines are bars | (ASCII-code 124) Horizontal lines are minuses - (ASCII-code 45) The first input list specifies the number of minuses between each plus sign, in the ...
Given two integers as input in an array, draw a rectangle, using the first integer as width and second as height. Or, if your language supports it, the two integers can be given as separate inputs. Assume the width and height will never be less than 3, and they will always be given. Example Outputs: [3, 3] |-| | | |-| ...
What general tips do you have for golfing in Haxe? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Haxe (e.g. "remove comments" is not an answer). Please post one tip per answer. Haxe can be run online here!
Task description In number theory, the Carmichael function λ takes a positive integer n and returns the least positive integer k so that the k-th power of each integer coprime to n equals 1 modulo n. Given a positive integer n, your solution must compute λ(n). The shortest code in bytes wins. Your program should theore...
The challenge Your program or function will accept a single string input from STDIN or a function parameter. You can assume the input will contain only alphabetic characters (a-zA-Z), spaces, and full stops. Input is case insensitive, so you should treat 'a' exactly the same as you would treat 'A'. For each character i...
I know you've always thought about the trials and tribulations of experiencing the joys of life as a web proxy. Honestly, who hasn't? Today you're tasked with realizing this goal (at least a part of it). Website X gets a lot of traffic on the daily and is looking for a PaaS (clearly this refers to Proxy as a Service) b...
Given a text like this: # #### ## # ## # ## # #### ## Output the same text but by connecting the pixels with the characters ─│┌┐└┘├┤┬┴┼. If a pixel doesn't have any neighbours, don't change it. So the output of the last text is: │ ─┬── ┌─ │ └─ │ ┌┘ │ └──┘ ─┘ You can take input as a boolean array. The inp...
Introduction According to Rand Al'Thor's post in the Puzzling SE, a close-knit word is any word that contains three alphabetically consecutive letters (in any order). Words like education, foghorn and cabaret are all considered close-knit words whereas words like learning, klaxon and perform are not close-knit words. C...
Given an integer N > 1, output all other numbers which prime decompositions have the same digits as the prime decomposition of N. For example, if N = 117, then the output must be [279, 939, 993, 3313, 3331], because 117 = 3 × 3 × 13 therefore, the available digits are 1, 3, 3 and 3 and we have 279 = 3 × 3 × 31 939 =...
Challenge Given a single word as input, determine if the word is odd or even. Odd and Even words Assume the general rules: odd + odd = even even + odd = odd odd + even = odd even + even = even In the alphabet, the odd letters are: aeiou And the even letters are: bcdfghjklmnpqrstvwxyz The same applies to capital lett...
It's strange that I haven't seen this, as Excel seems to be a valid language for code golfing (despite its 'compiler' not being free). Excel is somewhat of a wildcard in golfing, being good at golfing challenges of medium complexity, and sometimes simpler challenges as well. More often than not, Excel is good at challe...
Introduction For this example, let's take the string Hello, World! and the array [3, 2, 3]. To find the substring chain, we go through the following process: The first number of the array is 3, so we get the substring [0 - 3], which is Hel. After that, we remove the first 3 characters from the initial string, which lea...
I was wondering if there are any esoteric or golfing languages which specifically target text output and ASCII art? For example, 05AB1E at least started by targeting base conversions. Are there any golfing languages targeting text output and text output art? If so, do they have tip pages here, and are they in common ...
My coworker, Jimmy is kinda new to C/C++. He's also kind of a slow learner. Now, to be fair, his code always compiles, but he has some really sloppy habits. For example, everybody knows that you can define an array like this: int spam[] = {4, 8, 15, 16, 23, 42}; Everybody that is, except for Jimmy. He is convinced tha...
The Challenge Given two strings containing only lowercase letters and no spaces, the result should be the shorter string, followed by an underscore, followed by the longer string with the first instance of a character removed for each character it contains that is in the shorter string. You can assume the strings will...
Challenge: Take a vector / list of integers as input, and output the largest number that's adjacent to a zero. Specifications: As always, optional input and output format You may assume that there will be at least one zero, and at least one non-zero element. Test cases: 1 4 3 6 0 3 7 0 7 9 4 9 0 9 0 9 15 -2 9 -4 -6...
Background In 1870 Émile Baudot invented Baudot Code, a fixed-length character encoding for telegraphy. He designed the code to be entered from a manual keyboard with just five keys; two operated with the left hand and three with the right: The right index, middle and ring fingers operate the I, II, and III keys, res...
My Precalc teacher has one of his favorite problems that he made up (or more likely stole inspired by xkcd) that involves a row of n urinals. "Checkmate" is a situation in which every urinal is already occupied OR has an occupied urinal next to them. For instance, if a person is an X, then X-X--X is considered checkmat...
Hey guys, first time poster here. I went on Coderoulette recently and some guy posted this question. I looked around online but it doesn't seem to be anywhere. I figured I would post it here for anyone who is a fan of these types of problems. Enjoy! Alexa is a druid who loves Mathematics! She lives in the land of Alfa...
A sequel to this question. Task Given an array of positive integers, find the largest element k for which: There exists some positive integer distance n, so that the element in the array located n places to the left or right from k equals n. The array is guaranteed to contain at least one element satisfying this cond...
Poker has etiquette in how you arrange your chips, often enforced in tournaments - your chips may not be "hidden" from your opponents by being behind others, mostly to not hide some large denomination chip(s). The Challenge We are going to be playing poker in ASCII, so we need to write a function or program that will ...
The challenge is to list all ordered partitions (composition (combinatorics)) of a given positive integer n. These are the lists of numbers from 1 to n whose sum is n. For example, given input n = 4, the result should be: 4 1, 3 3, 1 2, 2 2, 1, 1 1, 2, 1 1, 1, 2 1, 1, 1, 1 The result can be in any order...
You're a mouse. Your mouse friends have all been captured, and are unconscious and trapped in a maze that has only one entrance/exit. You happen to have a perfect map of the maze, so you can plot a solution to rush in and carry them all to safety. However, the maze is guarded with a security system that will trigger an...
A pyramidal matrix is a square matrix where all numbers increase or decrease from the center point, like the two matrices below: 1 1 1 1 1 1 2 2 2 1 1 2 3 2 1 1 2 2 2 1 1 1 1 1 1 Or: 3 3 3 3 3 3 2 2 2 3 3 2 1 2 3 3 2 2 2 3 3 3 3 3 3 Given a non-zero integer n, create a pyramida...
Given N decanters (0 < N < 10) with that can hold C0 ... CN-1 liters (0 < C < 50) and a goal G liters, please determine if it is possible to reach that goal using only the following actions: Fill a decanter Empty a decanter Pour from one decanter to another until the one being poured to is full or the one being poured...
Tab completion is a useful feature that auto-completes partially written commands. You're going to be implementing it. For example, if the available commands were ['apply','apple','apple pie','eat'], then a would complete to appl, as all of the commands that start with a also start with appl. Input/Output You need to...
A string is called a "prime string" if it can't be written as a concatenation of more than one of the same string. Your task is to write a program that, given a sequence of letters of length N (5 < N < 100), determines if it is prime or not. Examples Input: AABBAA Output: not prime, false, 0, etc. Input: FDFJKEHKLJHD...
Input: A list/array of integers for which each item is in the range of 2-36. Output: The sum of the integers (as base 10), where each next integer is in the base of the previous value (starting with a regular base 10). Example: Let's say we have an input like this: [4, 12, 34, 20, 14, 6, 25, 13, 33] Then we have a sum ...
A number is balanced if the sum of the digits on each half of the number is equal, so: 1423 is balanced because 1+4 = 2+3, so is: 42615 because 4+2=1+5. Note that the middle digit is not included on either side (or it's included on both sides) if there's an odd number of digits. Challenge: Take a positive integer as in...
We'll define the ASCII Odd/Even Cipher via the below pseudocode: Define 'neighbor' as the characters adjacent to the current letter in the string If the one of the neighbors is out of bounds of the string, treat it as \0 or null Take an input string For each letter in the string, do If the 0-based index of the cur...
Introduction The Prime Counting Function, also known as the Pi function \$\pi(x)\$, returns the amount of primes less than or equal to x. Challenge Your program will take an integer x which you can assume to be positive, and output a single integer equal to the amount of primes less than or equal to x. This is a code-g...
Tic-Tac-Latin! This is a true story, so names have been altered. My latin teacher, Mr. Latin, created his own proprietary (no joke) tic tac toe variant. Let's call it tic-tac-latin. The game is simple, it is essentially tic tac toe played on a four by four grid. Formal rule declaration A line is either a row, column o...
Ok, so the input here is going to be a .csv file and so is the output. Now, given a .csv file/input like so "apple","banana","apple,banana","orange" "grape","orange","grape,orange","sprout" # 0 1 2 3 strip out all commas for a given nth column's entries (index starts at 0). So, for the input ...
(Inspired by this challenge.) Let's say we have a string ABBCBA. We can say that there is a rise between A and B, for B follows A; we can say that there is a run between B and B, for nothing changes; and finally we can say there is a fall between C and B. We can draw a graph like this: A B B C B ...
What general tips do you have for golfing in S.I.L.O.S? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to S.I.L.O.S (e.g. "remove comments" is not an answer). Please post one tip per answer. S.I.L.O.S can be run here.
This is sequel to this challenge by Adnan. If you like this challenge, chances are you'll like the other one too. Check it out! A multiple choice test with 8 questions each with 4 choices might have the answers: BCADBADA. Converted to four different arrays, with true and false if the current letter is the answer, it w...
What general tips do you have for golfing in Emotinomicon? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Emotinomicon (e.g. "remove comments" is not an answer). Please post one tip per answer.
Your task is to write a program or function that takes a string as input, and prints Hello (input), I'm (language name). Examples Python: Input: Oliver Output: Hello Oliver, I'm Python C++: Input: Jacob Output: Hello Jacob, I'm C++ etc. Remember, this is code-golf, so the code with the lowest number of bytes wins. Lead...
Task Given the pre-order and post-order traversals of a full binary tree, return its in-order traversal. The traversals will be represented as two lists, both containing n distinct positive integers, each uniquely identifying a node. Your program may take these lists, and output the resulting in-order traversal, using ...
Challenge Given a string such as Hello World!, break it down into its character values: 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33. Then calculate the difference between each consecutive pair of characters: 29, 7, 0, 3, -79, 55, 24, 3, -6, -8, -67. Finally, sum them and print the final result: -39. Rules ...
Credit My thanks to Rand Al'Thor's letter-based question for the inspiration for this code-golf challenge. Background The nature of this challenge is based off the algorithm mentioned by Rand in his "A Triangle Formed of Three Letters": Start with a sequence of 10 letters each of which is X, Y, or Z. Under each row, ...
Ever fancied creating cool twitter hashtags such as #brexit or #brangelina? this golf is for you. Write a program that accepts two strings A & B as input and merges them according to the following algorithm: let n be the number of vowels groups in A (e.g. britain has 2 vowels groups : i in position 3 and ai in positi...
The challenge is simple: write a program or function that, when given a finite non-negative integer, outputs a nested array. The rules Your code must produce a unique valid nested array for every integer 0 ‌≤ n ‌< 231. Every possible nested array with up to 16 open brackets must be outputted within this range. (This d...
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...
Challenge: Given a checkerboard, output the smallest amount of moves it would take (assuming black does not move at all) to king a red piece, if possible. Rules: Red's side will always be on the bottom, however their pieces may start in any row (even the king's row they need to get to). Black pieces are stationary, me...
A guitar fretboard diagram looks like this: 0 1 2 3 4 5 6 7 8 9 10 11 12 <- Fret number (0 means it's open) |-E--F--F#-G--G#-A--A#-B--C--C#-D--D#-E |-B--C--C#-D--D#-E--F--F#-G--G#-A--A#-B |-G--G#-A--A#-B--C--C#-D--D#-E--F--F#-G |-D--D#-E--F--F#-G--G#-A--A#-B--C--C#-D |-A--A#-B--C--C#-D--D#-E--F--F#-G--G#-...
Having spend some time on this site I have come to enjoy things being as short as possible. That may be the reason why I'm recently kind of offended by strings containing the same characters more than once. Your job is to write a function or program which condenses a given string according to the following rules: Star...
The Challenge: Consider the function F(N) = 2^N + 1 where N is a positive integer less than 31. The sequence defined by this function is: 3, 5, 9, 17, 33, 65, 129, 257, 513, 1025, 2049, 4097, 8193, 16385, 32769, 65537, 131073, 262145, 524289, 1048577, 2097153, 4194305, 8388609, 16777217, 33554433, 67108865, 134217729, ...
Things to know: First, lucky numbers. Lucky numbers are generated like so: Take all the natural numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20... Then, remove each second number. 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39... Now, 3 is safe. Remove every 3...
XKCD #99, with the title "Binary Heart" shows a simple image of ones and zeros, with some digits colored red. The red heart is visible to the naked eye, but the message hidden in the binary sequence is not. If you remove all the spaces and newlines and interpret the binary sequence as 8 bit ASCII-code, you'll end up ...
Recently I read the novel "The Solitude of Prime Numbers" where the main characters are somewhat compared to twin prime numbers ("always together, but never touching"). A twin prime is a prime number that is either \$\require{cancel}2\$ less or \$2\$ more than another prime number —for example, the twin prime pair \$(...
Crash Course on DST Dempster–Shafer theory (DST) provides a method to combine various sources of evidence to form a belief. Given a list of possible statement (one of which is the true answer), each possible combination of statements is assigned a "mass" indicating the degree of supporting evidence. The total mass of...
Prologue After installing an anti-XSS browser extension, Stack Snippets suddenly stopped working all across the Stack Exchange network. I could no longer learn from Stack Overflow, see working demos on User Experience and, worst of all, could not test JavaScript answers on Programming Puzzles and Code Golf! Desperately...
Given a atomic number, print how many electrons are in each shell of the element that the atomic number corresponds to. Expected input/output: Input -> Output 1 -> 1 2 -> 2 3 -> 2, 1 4 -> 2, 2 5 -> 2, 3 6 -> 2, 4 7 -> 2, 5 8 -> 2, 6 9 -> 2, 7 10 -> 2, 8 11 -> 2, 8, 1 12 -> 2, 8, 2 13 -> 2, 8, 3 14 -> 2, 8, 4 15 -> 2, 8...
Your challenge is simple. You need to write a program that prints to either STDOUT or a file the year the language it is written in was released. Because this is such a simple task, the twist is that it must be written in as many different languages as possible. Your score is the total number of different years that ar...