instruction
stringlengths
34
53.1k
Given an array of numbers, find out how many iterations of averaging* it takes for the average of every element to be no more than 1 higher or lower than the first element (absolute difference between the array's average and the first element is less than or equal to 1). *Array averaging To "average" a number in our ar...
Definitions Two numbers are co-prime if their only positive common divisor is 1. A list of numbers is mutually co-prime if every pair of numbers within that list are co-prime with each other. A factorization of number n is a list of numbers whose product is n. Task Given a positive number n, output the mutually co-pr...
Make a Windows style Loading bar by the following instructions. (notice that this is different than Loading... Forever) Your output should start by [.... ]. Every tick, you should wait 100 ms, then move each dots by one character right. if the dot is on the tenth character, move it to the first. Notice that you s...
Create a progress bar indicating year progress Your code has to output the percentage of the year already passed form 1st of January of the current year. You have to display a progress bar and the figure. Input You may use builtins to get the current date, if your language doesen't have it you can get date as input but...
TL;DR: Solve this particular challenge, a robot simulation, by stepping on all of the white pads, and avoiding the gray pads. You can step on a white pad any number of times, as long as you step on each white pad at least once. Solutions in languages like Befunge with a 2D instruction pointer would also be accepted, bu...
Challenge Write a program that outputs the lyrics to 99 Bottles of Beer, but instead of "beer", output "fizz" if the number of bottles on the wall is a multiple of 3, "buzz" if it is a multiple of 5, and "fizzbuzz" if it is a multiple of 3 and a multiple of 5. If the number of bottles on the wall is not a multiple of 3...
Given a linear equation mx+n, return n and m. However, the equation may be in any of the following formats: 5x+2 -> 5 2 5x-2 -> 5 -2 5x -> 5 0 -2 -> 0 -2 x -> 1 0 Here are the formats, where each ? stands for a positive integer written without leading zeroes ?x+? ?x-? -?x+? -?x-? x+? x-? ? -? ?x -?x x All of t...
What general tips do you have for golfing in ///? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to /// (e.g. "remove unnecessary whitespace" is not an answer). Tips for itflabtijtslwi and Lines are on-topic and valid here as well. Please post one tip per ...
Implement the Discrete Cosine Transform (DCT). This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input. Your program must be able to handle sequences of any length (assuming a hypothetical version of your language which has no limits on things l...
Challenge Given a valid goo.gl shortened link, output the original URL. Example goo.gl/qIwi3N would give something like https://codegolf.stackexchange.com/. For input, you can choose to have the https?:// at the beginning, you can choose to have www. before the goo.gl, and you can also choose to get rid of the goo.gl i...
Take an array which consists of positive integers or arrays, output if it only contains 2s. Output should be a truthy or falsey value (Sorry if this destroys answers) Truthy Test Cases [2] [2,2] [[2],[2,2],2] [] [[],[]] Falsey Test Cases [1] [22] [2,2,2,1] [[1,2],2] Standard Loopholes Are forbidden. Default IO rules ...
Given a string s and a non-negative number n less than the length of s, output the character at the n-th position of s. 0-indexing and 1-indexing are allowed. For 1-indexing, n will be positive and less than or equal to the length of s. s will consist of printable characters only. Any reasonable input/output is permitt...
For those who didn't know, Sigma is a Greek letter which is heavily used in mathematics as the summation sign. Given a string representing an expression depending on \$k\$ that we will denote \$E(k)\$, compute the sum of the results for \$E(k)\$, for each \$k\in\{1,2,3,4,5\}\$. Concisely, you should find \$S\$ such th...
The Task In this challenge, your task is to write a program or function which takes in a String and outputs a truthy or falsey value based on whether the first character and the last character of the input String are equal. Input You may take input in any way reasonable way. However, assuming that the input is present...
About the Series First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You can find the leaderboard along with some more information about the series in the first post. Hole 8: Shuffle an infinite ...
Given a positive integer N, your task is to return the number of steps required by the following algorithm to reach N: Find the smallest triangular number Ti such that Ti ≥ N. Build the corresponding list L = [ 1, 2, ..., i ]. While the sum of the terms of L is greater than N, remove the first term from the list. If t...
Suppose we start with the infinite list of prime numbers: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ... Then, we take the absolute differences between each pair of numbers, repeatedly: [1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, ... [1, 0, 2, 2, 2, 2, 2, 2, 4, 4, 2, 2, ...
Challenge Given a quark composition of a particle as input, output the corresponding hadron's name. Quarks will be represented by a capital letter and antiquarks by a lowercase letter. The quarks may be in any order, not necessarily the order given below. Built-in functions the access data about particles and/or quarks...
Given a nonzero polynomial with integer coefficients and roots that are on the imaginary and on the real line such that if a is a root then so is -a, return another polynomial with the roots rotated by 90 degrees. Details The polynomial can be given in any reasonable format, e.g. as a list of coefficients. The symmetry...
In graph theory, a Cactus is a connected graph such that any distinct two simple cycles in the graph share at most one vertex. Here is a Cactus with 3 simple cycles outlined with dashed lines. The following graph is similar to the one pictured above but is not a Cactus because the two vertices labeled in red are share...
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...
Definitions An algebraic number is a number that is a zero of a non-zero polynomial with integer coefficients. For example, the square root of 2 is algebraic, because it is a zero of x^2 - 2. A transcendental number is a real number which is not algebraic. Task You are to choose a transcendental number. Then, write a...
Intro More complex than A square of text since this requires padding and input has unknown data type. Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. This is a language agnostic code-golf edition of this year's tenth problem. I have explicit permission to post this ch...
Given a non-empty 2D array consisting of 0 and 1, find the number of squares whose 4 corners are all 1. The squares do not need to be "upright". All the rows are guaranteed to have the same length. Reasonable input/output methods are allowed. Testcases: 0001000 1000000 0000000 0000100 0100000 This returns 1. 10101 000...
I'll start off by saying I checked and checked again that this question should be on topic. I will also clearly state that this is a tips question about further golfing a certain set of code not a challenge. I recently answered the following challenge: Scramble words while preserving their outlines: It is well know...
Introduction For my 5th KOTH, I present to you a challenge based on the well-known game Battleship with a few twists. You'll only command one ship, whose type you'll be able to select between the 5 "traditionnal" classes, but you'll be able to undertake multiple actions each turn, including moving! This is played as a ...
A lawn is defined as a rectangular field with of one character surrounded by two layers of visible whitespace. This means two lines above and twos lines below, and a two space padding on the left (the right has visible whitespace, so you do not need to include it).     ||||| ||||| |||||     A mowed lawn is...
Results (May 22 2017 21:40:37 UTC) Master won 18 rounds, lost 2 rounds, and tied 0 rounds Save One won 15 rounds, lost 3 rounds, and tied 2 rounds Machine Gun won 14 rounds, lost 3 rounds, and tied 3 rounds Monte Bot won 14 rounds, lost 3 rounds, and tied 3 rounds Amb Bot won 12 rounds, lost 8 rounds, and tied 0 rounds...
Definitions An algebraic number is a number that is a zero of a non-zero polynomial with integer coefficients. For example, the square root of 2 is algebraic, because it is a zero of x^2 - 2. The corresponding polynomial is called the minimal polynomial of the algebraic number, provided that the polynomial is irreduci...
Challenge Given a plot with broken paths, return the plot with all paths connected in the minimum number of changes. Explanation This problem deals with graphs on the Cartesian plane. Every node has 8 possible edges, extending vertically, horizontally, or diagonally. Each direction is represented by a number 0-7 as fol...
What general tips do you have for golfing in Mini-Flak? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Mini-Flak (e.g. "remove comments" is not an answer). Please post one tip per answer. Mini-Flak is just Brain-flak without [], <...> or <> so tips for ...
Introduction Unlike English, German is considered to have quite a phonemic writing system. That means that the correspondence between spelling and pronunciation is close. Given any word you aren't familiar with, you would still know how to pronounce it because of the spelling system. This means a computer should be abl...
Task: Given sample index, x, calculate sample value f(x) of triangular wave, with period of 4 samples and amplitude 1. Offset can be negative and sample value could be either {0, 1, -1}. Test cases: -5 -> -1 -4 -> 0 -3 -> 1 -2 -> 0 -1 -> -1 0 -> 0 1 -> 1 2 -> 0 3 -> -1 4 -> 0 5 ->...
Given two numbers, print a page with an "X" in the specified location (±10%). The numbers must be either percentages or fractions of the page's print area dimensions, e.g. [25,75] or ["15%","0%"] or [0.33,1]. You do not have to consider margins. Just remember to state which number is width, and which is height, and whi...
Warning The answers to this challenge test for a specific version of the patch that helps stop WannaCrypt/WannaCry attacks. Depending on your operating system, you may have a different patch. The best way to protect yourself is to make sure your PC is fully up to date and be careful when opening attachments and web lin...
Wikipedia: Zeno's Dichotomy Paradox An infinite number of mathematicians walk into a bar. The first one orders a beer. The second one orders half a beer. The third one orders a fourth of a beer. The bartender stops them, pours two beers and says, "You're all a bunch of idiots." Reddit Print the following series for a...
The Task This is my first challenge so apologies if it is very simple! In this challenge, your task is to write a program or function which takes in a list of integers and a desired sum and outputs a truthy or falsey value based on whether the list contains two numbers that can be summed together to achieve the desire...
Objective Create a function to reverse string concatenation Input Two strings (alphanumeric + spaces), where one should be subtracted for the other. You can assume that the string to be subtracted will never be larger than the other one. Output The result from the subtraction Subtraction You should remove one strin...
Challenge Given an integer \$Q\$ in the range \$-2^{100} ≤ Q ≤ 2^{100}\$, output the number of digits in that number (in base 10). Rules Yes, you may take the number as a string and find its length. All mathematical functions are allowed. You may take input in any base, but the output must be the length of the number i...
The task: Output a value for x, where a mod x = b for two given values a,b. Assumption a and b will always be positive integers There won't always be a solution for x If multiple solutions exist, output at least one of them. If there aren't any solutions, output nothing or some indication that no solutions exist. Buil...
Your challenge is to find the file extension of a provided filename: hi.txt -> txt or .txt carrot.meme -> meme or .meme lol (undefined behavior) what..is..this..file -> file or .file .bashrc -> bashrc or .bashrc T00M@n3KaPZ.h0wC[]h -> h0wC[]h or .h0wC[]h agent.000 -> 000 or .000 You must get the text from the last . ...
What general tips do you have for golfing in 2 dimensional programming languages? I'm looking for tips which can be applied to code-golf problems and are specific to 2D programming languages, but not specific to any one language (Responses like "remove comments" and "use the M operation" are not answers). Please post ...
Challenge Given the phase of the moon, draw it using ASCII art. Your program must handle new moon, waxing crescent, first quarter, waxing gibbous, full moon, waning gibbous, last quarter, and waning crescent. Your input will be an integer. 0 -> new moon 1 -> waxing crescent 2 -> first quarter 3 -> waxing gibbous 4 -> f...
Now that other users have helped Trump build the wall, its time for you to climb it. This is an ascii art challenge where you need to output a climbing wall with randomly placed holds. A climbing wall is made up of panels each of which has between 3 and 10 holds and is 5 panels high. Each panel is 4 characters high and...
In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules: You may only output bytes in the printable ASCII range (0x20 to 0x7E, inclusive), or newlines (0x0A or 0x0D). Your code must not be a...
The Fibonacci sequence is a fairly well known thing around here. Heck, it even has its own tag. However, for all that, we sure like to stick to our roots of 1, 1, ... (or is it 0, 1, ...? We may never know...). In this challenge, the rules are the same, but instead of getting the nth item in the Fibonacci sequence, you...
Sona is in her house with her 10 year old daughter. She needs to go to school to bring back another child from school, as school is over at 2 pm. It's hot outside, so she wants to leave her younger child at home. She gave a bunch of strings to her child to keep her busy while she is gone. She asked her to reverse the w...
The day of the week and month of the year seem to get a lot of attention but no one seems to care about the week of the year. I believe it's time to change that, so your job is to write a program or function that when given a date outputs an integer between 1 and 53 corresponding to the current week of the year. For th...
OUTPUT: The number of seconds since midnight on January 1, 1 A.D., as an integer. INPUT: None, you must pull the current timestamp yourself. TASK: This is code-golf, shortest answer in bytes wins. Standard loopholes apply.
(yes, that title was intentional) Your task is to correct common grammatical mistakes. You must: Capitalise the first letter of each sentence, ie the first non-whitespace letter after any of .!? and, additionally, capitalise the first letter of the input Remove repeating punctuation, such as !!! -> !. Ellipses (...) a...
Now that I'm thoroughly addicted to Code Golf, it's probably about time that I try to pick up a few golfing languages. Given that I play almost exclusively in JavaScript, Japt seems like the logical language to start with. I'll be diving into the documentation at the next opportunity I get but, in the meantime, please ...
There was recently (a few years back) some buzz on programming websites about an implementation of Tetris in 140 Bytes. ... It turns out that although it is small, it is a simplified version of Tetris, and not even a complete implementation. Only the core logic function fits in 140 bytes of Javascript. To actually run ...
I have an expression that could be expressed as either of : a += (A ? B ? x : C ? y : D : D); a += (A && B ? x : A && C ? y : D); where A,B,C are expressions of 5-10 bytes each, and x and y are single character literals (3-4 bytes). D is another chain of ternaries (without the branching problem). I'm getting stuck tr...
You will be given a two-dimensional array and a number and you are asked to find whether the given matrix is Toeplitz or not. A matrix is a Toeplitz matrix if every descending diagonal, going from left to right, has only one distinct element. That is, it should be in the form: Input Format: You will be given a functio...
I saw this recent Puzzling question: Add parentheses to make this true And saw that one answer used a Python script to try all possibilities. Your challenge is, given an expression (as a string) and an integer, is to make a program that can tell whether you can add parens to make the expression equal the integer. For ...
Given a non-empty list of integers, output every possible partitioning of the list where each partition is a non-empty sublist. So for the list [1, 2, 3, 4] the result is: [[1, 2, 3, 4]] [[1, 2, 3], [4]] [[1, 2], [3, 4]] [[1, 2], [3], [4]] [[1], [2, 3, 4]] [[1], [2, 3], [4]] [[1], [2], [3, 4]] [[1], [2], [3], [4]] The...
Take a non-empty matrix / numeric array containing positive integers as input. Return, in this order, the sums of the first row and column, then the second row and column and continue until there aren't any more rows or columns. Suppose the input is: 2 10 10 2 4 9 7 7 2 9 1 7 6 2 4 7 ...
For this challenge, you must create a programme which takes an integer x and outputs its source x many times. Rules This is codegolf, the aim is to golf your programme to have the least amount of bytes If you submit a function, the function must take x as a parameter and either return or print the entirety of your co...
A digit word is a word where, after possibly removing some letters, you are left with one of the single digits: ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT or NINE (not ZERO). For example, BOUNCE and ANNOUNCE are digit words, since they contain the digit one. ENCODE is not a digit word, even though it contains an O,...
You will be given a number x, where 0 <= x <= 2^32 - 1. You should output a list of numbers in decimal, after recursive splitting in binary format. Examples: Example 1: 255 -> 255 15 15 3 3 3 3 1 1 1 1 1 1 1 1 The current list is just 255. The binary representation of 255 is 1111 1111. Splitting it, we get 1111 and 1...
In the video game Minecraft, you can obtain beacons and put them on pyramid-like structures to give you special effects, such as speed or jump boost. Your task is to, given an effect, construct the beacon pyramid required for it. There are multiple sizes of beacon pyramids, required for different effects. The largest h...
Write a proper quine whose every rotation is itself a proper quine. For example, if your source code is abcdef, then: abcdef would output abcdef bcdefa would output bcdefa cdefab would output cdefab defabc would output defabc efabcd would output efabcd fabcde would output fabcde A rotation "is made by splitting a str...
A rotation "is made by splitting a string into two pieces and reversing their order". An object is symmetrical under an operation if the object is unchanged after applying said operation. So, a "rotational symmetry" is the fact that a string remains unchanged after "rotation". Given a non-empty string s consisting of o...
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 denominators, displays resulting fractions after simplification (2/4=>1/2), separated by "+"s, displays "=" and result ...
Yesterday, I left my sandwich on the table. When I got up today, there was a bite in it... Was it mine? I can't remember... Problem: Take a representation of the sandwich and my bite pattern and tell me if it was my bite or not. Examples: Example 1: My bite pattern: .. . Sandwich: ##### .#### ..### Output: truthy Ex...
Find the original challenge here Challenge Given an integer, Z in the range -2^31 < Z < 2^31, output the number of digits in that number (in base 10). Rules You must not use any string functions (in the case of overloading, you must not pass a string into functions which act as both string and integer functions). You a...
(heavily inspired by Element of string at specified index) Given a string s and an integer n representing an index in s, output s with the character at the n-th position removed. 0-indexing and 1-indexing are allowed. For 0-indexing, n will be non-negative and less than the length of s. For 1-indexing, n will be posit...
Based on this: Make me a square! You need to output this: #### # # # ### # # # # #### Where "#" is replaced with the input. If you input "A", you should get AAAA A A A AAA A A A A AAAA If you input "&", you should get &&&& & & & &&& & & & & &&&& Leaderboard Here is a Stack Snippet to generate both a reg...
*What is a transmogrifier? In the C programming language, there are formations called digraphs and trigraphs that are two and three characters sequences that evaluate to less common characters. For example, you can use ??- if your keyboard doesn't have ~. Given text, replace all instances of the following digraphs and ...
Disclaimer It is bad practice to draw out your molecules in 2 dimensions because that is not how they are. I chose to do this in 2D because it is easier to explain. Note that the bond angles are wrong too: the angle in CH4 is 109.5°, not 90° as I said and the bond angle in NH4 is 107°. BHCl2 does have a bond angle of ...
The Task Given a natural number as input, your task is to output a truthy or falsey value based on whether the input is a factorial of any natural number. You can assume that the input number will always be in the range of numbers supported by your language, but you must not abuse native number types to trivialize the ...
Given text, remove leading and trailing whitespace (spaces, tabs, and newlines). Alternate title: Implement your own string trimming. Input ASCII text (printable + spaces, tabs (\t), and newlines (\n)), in whatever format you would like. Carriage returns (\r) are outside of the scope of the input. Output The same text ...
Task When running the program must show the season according to the host computer's current time. Rules The output must be either: Spring, Winter, Summer or Autumn. The capitalization does not matter. The output must not contain anything else the the season names stated above. A season is 3 months and january is in th...
This is a cake: _========_ | | +________+ | | +________+ | | +________+ It is 8 wide, 3 tall, and 1 deep. You must write a program that makes a cake from 3 inputs. The first input controls how many underscores there are in the middle and =s on the top. Here's the first cake with a width of 10 inst...
Task: Given the area of a triangle, find a Heronian triangle with that area. Any Heronian triangle with the specified area is allowed. A Heronian triangle is a triangle with integer sides and integer area. By Heron's formula, a triangle with sides lengths a,b,c has area sqrt(s*(s-a)*(s-b)*(s-c)) where s=(a+b+c)/2 is ...
A convenient and useful way to represent topological surfaces is with a fundamental polygon. Each side on a polygon matches to another side and can be either parallel or anti-parallel. For instance the here is the fundamental polygon of a torus: To figure out why this is a torus we could imagine our polygon being a ...
Challenge Given a rectangular area arrange a group of rectangles such that they cover the rectangular area entirely. Input An integer denoting the height. An integer denoting the width. The dimensions of the rectangles consisting of the following form: axb,cxd,... where a,b,c, and d are integers - any reasonable for...
Background The tabs versus spaces war in programming has been going on a long time, basically because spaces are too low-level to have all the properties you'd want for alignment and indentation, but tabs can't be relied upon to work in all contexts (with some programs optimizing the use of tabs for indentation whilst ...
A demonic number is a positive integer whose decimal representation consists of only 6. The list of demonic numbers starts with 6, 66, 666, 6666. Given a positive integer, output the nearest demonic number. If there are two, output the bigger one. Testcases: n output 1 6 2 6 3 6 6 6 35 6 36 66 37 66 100 66...
The Task In this challenge, your task is to write a program, which takes in no input, with as many anagrams that are quine of themselves as possible. Your score will be the number of anagrams of your program's source code that are valid quines divided by the total number of anagrams possible, i.e. the percentage of the...
Do you ever look at 3D shapes and think that we have 2 many dimensions. So let's make 3D into 1D! (See what I did there?) Task Given a 2D representation of a cube (layout below), flatten it into a single string, based on pointers. The CUBE This is the layout of the cube filled with no-ops (,) and pointers at the corner...
Sometimes, I have lists of constant matrices in my code: [ [[1, 0], [0, 1]], [[1, 0], [0,-1]], [[0, 1], [1, 0]], [[0,-1], [1, 0]] ] That's a terrible use of screen real estate. I'd much rather write them next to each other: [ [[1, 0], [[1, 0], [[0, 1], [[0,-1], [0, 1]], [0,-1...
I recently created a new language called ;# (pronounced "Semicolon Hash") which only has two commands: ; add one to the accumulator # modulo the accumulator by 127, convert to ASCII character and output without a newline. After this, reset the accumulator to 0. Yes, 127 is correct. Any other character is ignored. It ha...
Output an infinite sequence of positive integers, such that, for each element in the sequence, all positive integers that have not yet been output have a positive probability of being chosen, and no value is repeated. For example, if the first integer is 3, then 3 may not be output again, but all other positive integer...
Introduction: You are a worker, who is in charge of managing a set of bridges, connecting a square grid of "nodes": N - N - N | | | N - N - N | | | N - N - N (the grid here is 3 by 3, but they can be larger). Each of the bridges has a set capacity from 1 to 10, and each of the bridges has a number of cars over...
Challenge Find the oxidation states of each of the atoms in a given molecule. These can be output as a list or otherwise. Rules The total oxidation state of a molecule will always be zero. The total oxidation state is the sum of the oxidation states of each of the individual atoms in the molecule. The following atoms h...
Challenge Given a number, x where -1 ≤ x ≤ 1, and the integers a and b, where b > a, solve the equation sin(θ) = x for θ, giving all solutions in the range a° ≤ θ ≤ b°. Rules x will have a maximum of three decimal places of precision. The output, θ, must also be to three decimal places, no more, no less. Your output ma...
Target: Write a floor() function from scratch. Manipulating like converting float to string, and cutting all after dot are allowed. All languages are allowed. Any usage of built in language functions (like toInteger()) or similar is not allowed, casting operators are not allowed. So, your task is implement floor() func...
Challenge Given a positive integer, determine whether it is a triangular number, and accordingly output one of any two constant, distinct values. Definition A triangular number is a number that can be expressed as the sum of consecutive positive integers, starting at 1. They can also be expressed with the formula \$\fr...
A mad scientist has just created a new species of bacterium! He has decided to name it Noblus Gentlemanus, after observing its behaviour. However, his bacteria have ran out of food, and have declared war, as they are able to harvest other bacterium's corpses for enough food to create copies of themselves. There are ...
Related to: Make a ;# interpreter In the above linked challenge the task was to create an interpreter for the esoteric language ;#. The ;# language The language has exactly two commands: ; and # (all other characters are ignored by the interpreter): ;: Increment the accumulator #: Modulo the accumulator by 127, print t...
The Task In this challenge, your task is to write some code which outputs one of its anagrams chosen randomly with uniform distribution but it should never output itself. Elaboration Given no input, your program should output any one of the anagrams of its source code. Your program should never output its own source a...
Jarl Olaf lives in a beautiful village, Stackholm. In every year he is thinking about raiding a place to get some golden jewelery, food and programmers woman slaves. He is a good person but not the brightest one, so you need to help him decide the next target. He has three targets in his mind: Jarl Burg, England and Pa...
The famous Fibonacci sequence is F(0) = 0; F(1) = 1; F(N+1) = F(N) + F(N-1) (for this challenge we are beginning with 0). Your challenge: Given n, output the sum of all the dth Fibonacci numbers for all divisors d of the nth Fibonacci number. If you prefer more formal notation, Input: a positive integer n Output: the...
Challenge: Write a program that produces the following output: . E .. I ... S .... H ...- V ..- U ..-. F ..-- .- A .-. R .-.. L .-.- .-- W .--. P .--- J - T -. N -.. D -... B ...
Introduction Wardialing was a very interesting way to try to hack people back in the '80s and '90s. When everyone used dial-up, people would dial huge amounts of numbers to search for BBS's, computers, or fax machines. If it was answered by a human or answering machine, it hung up and forgot the number. If it was answe...
I live in the UK, where it rains. A lot. I also have the unfortunate necessity to need to wear glasses to see, which means that when it rains (as it is now), I can barely see out of them. This challenge is so that you can all experience the same! Task Output ASCII art glasses with a drop of water added each second. Inp...
;# is a very simple language. It has 2 commands: ; will increment the accumulator # outputs the accumulator modulo 127, and then resets the accumulator ;$ is also very simple and is very similar (and also does not yet exist). It has 2 commands: ; will increment the accumulator $ outputs the accumulator modulo 127. H...
Output this binary sequence of length 1160: -++-+--++-++-+--+--++-+--+--++-+--++-++-+-++--++-+---+-++-+--+--++++--+--++-+--++-++----++-++-+-++--++-+-+---++-+--++-++-+--++-+--+---+-++-+--++-++-+--+--++-++-+--++-+--+++-+-+----+++-+--+--+++---++-++-+--+--+++--+-+-+--+-+++-++-+--+--++-+--++-++-+--+--++--+++---+++-+---++-+-...
Poke is a really simple incomplete-information game. It's like "Poker", but simpler. At the start of every round, each player is dealt a hand. To simplify things, a hand is a uniformly distributed random number between 0 and 1. Each player only knows their own hand. The player that wins the round is the one whose hand ...