instruction
stringlengths
34
53.1k
Motivation: Sometimes you need to know where you are in a string. You want to be able to look at any part of a string and know exactly where you are, as far as possible. Challenge: write a program to output a tape measure string of a given length. A tape measure string self describes its length-so-far as often as possi...
Given 3 input items, a list of coordinate pairs, a 2D string, and a single-character string, output whether the character at each coordinate of the 2D string is equal to the single character. You can take the input in any order and the coordinates may be 1-indexed. You may take the 2D string as a 2D list, a list of li...
Summary Write a program or function, which doesn't take any input, and outputs all the integer numbers, between -1000 and 1000 in ascending order, to the stdout, one per line, like this: -1000 -999 -998 -997 ... And after that you need to print the time taken to print these numbers, or the time from the start of the p...
Given a list of math expressions that all hold true and consist of modulo remainder calculations with two numbers and a result, your task is to yield the first n numbers that hold true for all the statements in the list. For example: [m % 3 = 0, m % 4 = 1, m % 5 = 3], where % is the modulo operator. For n = 3, the fir...
XKCD Comic: Goal: Given a date, the current Dow Opening, and your current coordinates as a rounded integer, produce a "geohash." Input: Input through any reasonable means (STDIN, function argument, flag, etc.) the following: The current date. This does necessarily have to be the date of the system's clock, so assume ...
Background Many esoteric programming languages don't have numbers built in at literals, so you have to calculate them at runtime; and in many of these cases, the number representation can be quite interesting. We've already had a challenge about representing numbers for Underload. This challenge is about representing n...
Challenge: Take input of two black and white (monochrome) images and xor each pixel of the first, with each pixel of the second, add them to a new image and output the new image. Some clarifications: Size of pictures does not matter. Extension/Image format doesn't matter. You can make it take input any extension and ou...
Here’s how to backspace-and-retype from one string to another: Start from the first string. Remove characters at the end until the result is a prefix of the second string. (This may take 0 steps.) Add characters at the end until the result equals the second string. (This may take 0 steps, too.) For example, the path ...
I think it's easiest to explain this challenge in a sequential manner. Start with an input number \$N\$ and: Find its highest prime factor Check numbers above and below \$N\$ and see if the highest prime factor is higher (i.e. the highest prime factor of \$N-1\$ and/or \$N+1\$ is higher than the factor of \$N\$. Conti...
This question is about abelian sandpiles. Read this previous challenge and watch this numberphile video to learn more. An abelian sandpile of size n by n is a grid containing the number 0, 1, 2 and 3 (representing the number of grains of sand). Adding two sandpiles works by first adding element by element, and then to...
When code-golfing there will be times where you need a Hex Dump of your code, usually because you've used unprintable characters. So, why not make a program that Hex Dumps itself? The Challenge This challenge is to, given no input, output a Hex Dump of your source code in the following formatting: 0000: 00 00 00 00 00 ...
To neutralize data, recursively replace all numbers (not digits!) with zeros and all characters (not strings!) with spaces. You must accept any single number, character, or string, or possibly recursive array* of mixed numeric/character data that your language can handle. For example, you must accept actual strings (an...
Introduction You have been tasked to write a program that splits a rectangular integer array evenly in half (for whatever reason). This task is computationally intensive, but luckily you have a dual-core machine to perform the calculations. To maximize the benefits of parallelism, you decide to split the program evenly...
This is a cops-and-robbers puzzle the robbers' thread can be found here. Your task will be two write two programs (or functions) such that they are anagrams of each other and one performs the left inverse of the other. These programs may accept and output as many integers or complex numbers as you wish. If you choose...
This is a cops-and-robbers puzzle, the cops' thread can be found here. Your task will be to find an anagram of the provided programs in the cops' thread that performs its left inverse. Once you crack an answer post the solution as an answer below and notify the original answerer. You will be scored on the number of pro...
I found about Code Golf after writing this program and decided to post the rules here so you can try it out too. I saw this, which is a less restrictive version of my question. I've got a bit more rules which (in my opinion) make the task quite a lot more tougher. Title says it all. If the input is 8, we should get: 8 ...
Task Find all the non-negative integers up to and including a given non-zero positive integer n, that are prime and the count of 1's and 0's in their binary representation (having no leading zeroes) are prime too. Here are the first five such primes, 17, 19, 37, 41, 79 10001, 10011, 100101, 101001, 1001111 Clarific...
Task Given a ASCII diagram of a loop e.g. .................... ......@@@@@......... ......@...@......... .....@@...@@@@@..... ....@@........@..... ....@........@@..... ....@@@@@@@@@@...... .................... .................... And a location on the loop e.g. (7,1) You must find the inside and outside of the loop ...
I'd like you to build me a clock that displays time in this format: 18 ---------- 19 -------------------------------------------------- This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that ...
Background Programmers these days can't seem to keep their buffers straight! A common source of error is trying to use an array index that is too large for the buffer. Your task is to implement a buffer where large indices are reduced to a size that the buffer can handle. Because I decide exactly what's best for everyo...
Since I saw the first one a few years ago, I always was subjugated by this kind of word clock where the time is actually spelled out by words being lit up or not into a meaningful sentence. The text displayed on that clock is the following. IT IS HALF TEN QUARTER TWENTY FIVE MINUTES TO PAST TWO THREE ONE FOUR FIVE SIX...
Yup, you read the title right. play the sound of pi. More specifically, for every digit of pi in the first 1000, map it to a musical note and output the resulting melody to a file. Basically, each digit turns to a note on the C Major scale (basically the normal scale). so 1 turns to Middle C, 2 turns to D4, 3 turns to ...
Count the number of contiguous blocks within a given 3D input. Input The input will consist of one or more rectangles of characters separated by blank lines. Each rectangle represents a cross section of the 3D space. The characters used will be 0, representing empty space, and 1 representing a solid block. Example 0000...
Inspired by this default for IO. The Task Write a program that, given an input integer x between 0 and 255, crashes with exit code x. Restrictions You may not call anything which is intended directly for exit code output (System.exit(x), returning from main, etc.). Instead, your program must cause an error or crash wh...
Challenge Write a function or program that accepts a line of input, performs a very specific and oddly familiar shuffle on its characters, and outputs the result. The required shuffling can be described using the following algorithm: Label each character in the input with a 1 based index. Write character number 1 as o...
The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences. It contains nearly 280000 sequences of mathematical interest. Examples of sequences: positive integers (A000027) prime numbers (A000040) Fibonacci numbers (A000045) Your task is to write a program or function that displ...
Often I need a simple Hello World! program to show some basic concepts of a programming language on my travels. As I usually travel only with light luggage I can't to carry a Hello World! program for each language. So a program that generates Hello World! programs in as many languages as possible would be a great help....
EDIT It appears that there has been some confusion following my typo in the original post which used a lowercase o to define the plane and then an uppercase later. Unfortunately this bug did not get picked up in the Sandbox. Since many members have written answers with both and since the typo was my fault I will allow ...
Given a directed graph, output the longest cycle. Rules Any reasonable input format is allowed (e.g. list of edges, connectivity matrix). The labels are not important, so you may impose any restrictions on the labels that you need and/or desire, so long as they do not contain additional information not given in the in...
Task: Your challenge is, given previous submissions and itself as input, output the language that they're written in, in the following format: Say the first program is in Ruby. It must output 1, because Ruby is the 1st language used in this challenge. An example program is: a=gets puts 1 When given itself as input, it...
Challenge description On some channels on a popular streaming site twitch.tv a common message people tend to spam in chats to bait people into spamming "LUL" is One more LUL and I'm out LUL is a popular emote used to express that something funny happened on stream. Soon dank memes showed their potential and a parody o...
You should write a program or function which receives no input and outputs a stream of digits. The stream should contain at least once every positive integer number which does not contain the digit sequence 42. E.g. The string 1231 contains the integers 1 12 123 1231 2 23 231 3 31 (and 1 again) The stream should not c...
Disarium Dilemma A Disarium is defined as a number whose: sum of its digits powered with their respective position is equal to the original number Your Task: You have a strange obsession with numbers classified as being a disarium. The need to follow the ways of disarium is so great in you that you refuse to read a...
Task There is a set of numbers x, such that x^2 divides 7^x-1. Your task is to find these numbers. Given an input of n, the code will print the nth number that follows this rule. Examples 1-index In Out 3 3 9 24 31 1140 The relevant sequence can be found here. Rules Shortest answer will be the winner* Standa...
Sandbox post here. Create a function or program that "Springifies" a string. Input will be a String in Stdin, or closest alternative Input will only contain printable ASCII and/or spaces Output will be to Stdout, or closest alternative A trailing newlines and spaces are acceptable How to springify a String Format th...
Question : You will be given the starting and ending integers of a sequence and should return the number of integers within it which do not contain the digit 5. The start and end numbers should be included! Examples: 1,9 → 1,2,3,4,6,7,8,9 → Result 8 4,17 → 4,6,7,8,9,10,11,12,13,14,16,17 → Result 12 50,60 → 60 → Result...
Background Incident is a fairly unusual programming language, in that its list of tokens is not predetermined, but rather inferred from the input. As such, tokenising an Incident program can be fairly difficult, especially if you want to do so efficiently. This task is about doing that yourself. The task Your program w...
Challenge Description You have to show a simulation of rain in terminal. In the example given below its adding 100 raindrops at random (use the default random function which your language offers) coordinates, waiting for 0.2 seconds and then redrawing again until the given time expires. Any character can be used for r...
Given a non-negative integer \$n ,\$ output the \$n^{\text{th}}\$ Euler number (OEIS A122045). All odd-indexed Euler numbers are \$0 .\$ The even-indexed Euler numbers can be computed with the following formula (\$i \equiv \sqrt{-1}\$ refers to the imaginary unit): $$ E_{2n} = i \sum_{k=1}^{2n+1}{ \sum_{j=0}^{k}{ ...
There are an abundance of questions involving drawing shapes using asterisks - so I thought, with so many asterisks out there, we should draw one, using the ASCII table. Challenge Your task is to write a program or function which takes no input, and outputs this exact text: ! "# $% ...
Backstory Disclaimer: May contain made up information about kangaroos. Kangaroos traverse several stages of development. As they grow older and stronger, they can jump higher and longer, and they can jump more times before they get hungry. In stage 1, the kangaroo is very little and cannot jump at all. Despite this, is...
Brun's constant is the value to which the sum of the reciprocals of twin prime pairs (1/p and 1/(p+2) where p and p+2 are both prime) converges. It is approximately 1.902160583104. Given a positive integer N, approximate Brun's constant by summing the reciprocals of the twin prime pairs where both primes in the pair ar...
Now, we all know most languages have very simple ways to "self-modify" code. However, what if you were to actually modify the code and edit parts of it...on disk? Your goal is to make code that prints a number, then edits its own file to replace the number with the next one in the Fibonacci sequence like so: $ ./progr...
Write a program that terminates without an error. If any single byte is substituted by any other byte the program should output CORRUPTED Do not read your source code from a file Your program should not produce any other output This is code-golf so the shortest answer in bytes wins. Edit: removed "NOT CORRUPTED" req...
(Challenge taken from a multiplayer game (clash of code) at codingame.com) The challenge Find the n-th term of the following sequence: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4... or, to make it more obvious, {1}, {1,2}, {1,2,3}, {1,2,3,4}... The sequence is made up from concatenated ranges from 1 to x, starting from 1, all the way...
Write a program or function that takes two inputs: A text message The dictionary of English language, as it appears in this Github file (containing about 60000 words) and outputs the number of spelling errors in the message (see below for definition and test cases). You can receive the dictionary as a parameter to yo...
Your task is to create a program that will display the following text, wait for the user to press a key (it is okay to ignore keys like ctrl, alt, caps lock, etc., as long as keys like letters, numbers, symbols, and enter are not ignored), and then terminate the program: Press any key to continue... Trailing newlines...
Everybody has heard of the phrase "be there or be square". So I thought it was time for a challenge about it. Input You will take a full absolute directory address as text as input via STDIN or equivalent. Output If the directory address exists and is valid, your program will move itself to that folder on your computer...
Related Goats are great. Everybody loves goats. And they also, for some reason, are an excellent complex ascii art for many languages to have built-ins for. Because of this, I personally feel a catalogue to document just how easily a language can print goats is greatly needed. The Challenge Given an integer input via a...
Introduction There is a small village with nothing but a few houses and empty fields. The local bureaucrats want to divide the village into lots so that each lot contains exactly one house, and the borders of the lots form a nice straight-line grid. Your task is to determine whether this is possible. The task Your inpu...
Challenge Summary In summary, the challenge is to provide the glider synthesis for a Game of Life configuration, which is your input. What does this mean? Well, firstly, let me explain a few terms. By Game of Life, I mean Conway's Game of Life. If you don't know what this is, you can read the Wikipedia article at htt...
Introduction There is a tax collector that has some trouble managing the taxes of his kingdom: the historical records have burnt down in a great fire. He wants to find out how many possible pasts there could be in terms of where the current money was inherited from. Luckily, his kingdom is very simple. The kingdom can ...
The problem: Write a function which, given a cycle length n and a number of cycles m, where 'm' is within [2, n-2], generates m random cycles, each of length n, and all of which are derangements of each other. Then n=7, for example, m could be 2, 3, 4, or 5. All possible sets of m cycles of length n that fit the criter...
Write a program that will test the primality of a specified number, and give the output as a Boolean value (True is prime). Your prime test can (but doesn't have to) be valid for the number 1. Here's the catch: your program itself has to sum to a prime number. Convert every character (including spaces) to its Unicode/...
This is a Hello World challenge! Those plain ones! Yeah.... However, it's different this time. Because here, you can't use C or C++ or Stuck or ArnoldC or whatever you want. You can only choose raw x86 opcodes from this list, or any other x86 opcode lists. It is also assuming you have no Protected Mode or any other thi...
Challenge: In the programming language of your choice, shut down the machine that your code was executed on. Rules No shutting down by resource exhaustion (e.g.: forkbomb to force shutdown) You are allowed to write code that only works in a specific environment/OS, if you wish. Standard loopholes are forbidden This ...
Guide the Alphabet Given an array of directions, where the directions are defined as follows: NW N NE W . E SW S SE Or as indexes (you may use these indices for directions instead of the strings above): 0 1 2 3 . 4 5 6 7 You may choose either format, supporting both is not required by the challenge. Generate ...
Task You will be given a positive integer and you must output a "self-complementary graph" with that many nodes. If you don't know what a self-complementary graph is the wikipedia article wont help you much so below are two explanations, a technical and a non-technical one. Non-Technical A graph is a set of nodes that...
As George Orwell wrote in 1984: War is peaceFreedom is slaveryIgnorance is strength Write a program or function that takes in one of the six main words from the Orwell quote and outputs its counterpart. Specifically: [input] -> [output] war -> peace peace -> war freedom -> slavery slavery -> freedom ignorance -> stre...
Challenge: Write a code that, when executed will output the source code of a second program that can be executed in another language. The second program should output the source code of a third program that can be executed in a third language and so on. The last program should output PPCG with an optional single traili...
Challenge: In the programming language of your choice, take no input and output your programming language's name. Fair enough, right? Restrictions: You can't use any character that is included in your programming language's name in your code. E.g., if I use Batch, I must not use the chars 'B' 'a' t' 'c' 'h' in my code...
What is a home prime? For an example, take HP(4). First, find the prime factors. The prime factors of 4 (in numerical order from least to greatest, always) are 2, 2. Take those factors as a literal number. 2, 2 becomes 22. This process of factoring continues until you reach a prime number. number prime factors 4 ...
Golomb rulers are sets of non-negative integers such that no two pairs of integers in the set are the same distance apart. For example, [0, 1, 4, 6] is a Golomb ruler because all distances between two integers in this set are unique: 0, 1 -> distance 1 0, 4 -> distance 4 0, 6 -> distance 6 1, 4 -> distance 3 1, 6 -> di...
Introduction Long story short: a few days ago I accidentally started knitting a sock and the pretty logical structure of the plain stitches lead me to the idea: Why don't we just ASCII-knit a sock? Input The input is an even integer N in the range [2,30]. Output The output is a sock, obviously. Structure Because we wil...
One of the lesser known programming paradigms which seems rather fitting for code golfing is Overlapping Oriented Programming (OOP) *. When writing partly identical code, many bytes can be saved by simply overlapping the identical parts and remembering in some way where the two original code lines start. Your task is t...
Introduction Some of you may have heard of Hilbert's Grand Hotel. The manager there has lost his list of where the guests are staying but he still has the order in which they checked in. Each guest can not stay in a room with a room number less than their value and if a guest is added to a lower room, all guests in hig...
Write a program that produces an output such that: At least three distinct characters appear. The number of occurrences of each character is a multiple of 3. For example, A TEA AT TEE is a valid output since each of the 4 distinct characters, A, E, T and (space), occurs 3 times. Of course, a challenge about the numbe...
Create a program or function to unjumble a 9x9x9 cube of digits by rotating individual 3x3 cubes within it. This is similar to (but, I suspect, a bit harder than) my Flippin' Squares question. Input Input will be a 9x9x9 cube. I'm not going to be as strict over the input as I was last time, 3d arrays are allowed, array...
Write the shortest possible code which converts tabs to spaces in the input. Tab size should be supplied as a parameter or be hardcoded in the code in a single place. Spaces on output should point to the right column, e.g. (\t represents a tab character): a\tb aa\tb aaa\tb aaaa\tb should become (for tab size 4): a b...
Your very own "for" instruction Assuming you have the following input : a, b, c, d Input can be in one-line using any format "a/b/c/d" or "a,b,c,d" etc.. You can also have 4 inputs. You must code the following behaviour (pseudo-code here) : var i = <a> while (i <b> <c>) print i i = i + <d> print "\n" Here ...
A boring version of yourself Have you ever dreamed of a boring version of you which types the text you just typed ? No ? Because that's exactly what I'm challenging you to do ! The program needs to check how many time it took for the user to input a text at program launch and then retype the text again using the same p...
Brachylog is a language that's beginning to rise in prominence in code-golfing recently (and just received a major update with a terser syntax). Like Prolog, it has the advantage that it can often solve a problem (typically via brute force) merely from a sufficiently accurate description of what a problem looks like, a...
tinylisp is, in its essence, a very stripped-down version of Lisp, as the name suggests. It was made by @DLosc for an "interpret this language" challenge, which can be found here. It features a small amount of builtins, which can be used to create practically anything. There is a repository for the "official" tinylisp ...
Inspired by Sygmei's question, I'm interested in finding out what languages can "do this properly". Your task is to write a "for loop" function / macro / instruction. The arguments should be: an initializer a test an increment a body All of these are "pieces of code" and should be able to access variables in the con...
Your task is simple: write a program (or function) that takes no input and outputs (or returns) its source code. The catch is that when the program is wrapped in "quotes" (Unicode character 34), it should again output its (now quoted) source code. Standard rules for quines apply. This is code-golf, so the shortest prog...
The beautiful pattern drawer Good morning PPCG ! The other day, when I was trying to help someone on Stack Overflow, a part of his problem gave me an idea for this challenge. First of all, check the following shape : Where all black numbers are the index of the points in the shape and all dark-blue numbers are the ind...
Preface In the well known carol, The Twelve Days of Christmas, the narrator is presented with several gifts each day. The song is cumulative - in each verse, a new gift is added, with a quantity one higher than the gift before it. One Partridge, Two Turtle Doves, Three French Hens, and so on. At any given verse, N, we ...
The Pi function is an extension of the factorial over the reals (or even complex numbers). For integers n, Π(n) = n!, but to get a definition over the reals we define it using an integral: In this challenge we will invert the Π function. Given a real number z ≥ 1, find positive x such that Π(x) = z. Your answer must b...
Goal: Create a program to find the smallest file in the current folder. File size may be measured in bytes or characters. If multiple files have the same size, you can either choose one or display all of them. You can assume there will be at least one file in the folder, and no files will have a size of 0. Assume t...
Your task is to create a program that performs a bubble sort on a given array until it is sorted. Algorithm In order to qualify as a bubble sort, the program must operate as follows: Each pass goes through the array, looks at every two adjacent elements in turn, and potentially swaps them. Each pass goes through the ...
Implement a simple digital Stopwatch, which will display the time elapsed in seconds and minutes, as described below. Important Please read both Display and Controls sections ! Display Time elapsed, should be displayed in the MM:SS format, by replacing the previously displayed time string "in-place" (clearing the who...
A haiku is a poem with three lines, with a 5/7/5 syllable count, respectively. A haiku-w is poem with three lines, with a 5/7/5 word count, respectively. Challenge Write a program that will return true if the input is a haiku-w, and false if not. A valid haiku-w input must consist of 3 lines, separated by a newline. L...
Intro: You accidentally corrupted the flow of time with a device you made for fun, that turned out to be a time machine. As a result, you got pushed to the far future. You realized that computing, processing power, and computers in general have been evolved by a huge amount, an infinite amount to be precise. So you g...
Mike Bufardeci (Pyth) - 175 bytes Leo (Retina) - 175 bytes devRicher (Lua) - 182 bytes Peter Taylor (CJam) - Waiting for clarification Lyth (C++11) - Waiting for clarification Edit: Several changes made, should not affect any already submitted answers. Edit #2: Very few people are taking advantage of the 1024 b...
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...
A bronze plaque in the pedestal of the Statue of Liberty displays the poem "The New Colossus" by Emma Lazarus, part of which reads: Give me your tired, your poor, Your huddled masses yearning to breathe free, The wretched refuse of your teeming shore. Send these, the homeless, tempest-tost to me, I lift my lam...
The Challenge In this challenge, you are supposed to write a program or function that takes in a String, which will contain the simplified Markdown-like Markup, and outputs the corresponding HTML Markup. The Input You can take input in whatever way you wish to. The type of the input should be String. The Output You c...
You are providing tech support to the Bruce Dickenson as he produces a Blue Öyster Cult recording session. When he asks for more cowbell, you can give it to him. Your task Write a program or function that takes a string (or equivalent in your language) as input, and outputs a related string containing one more cowbell....
Write a program or function that given an integer radius r returns the number of unit squares the circle with radius r centered at the origin passes through. If the circle passes exactly through a point on the grid that does not count as passing through the adjacent unit squares. Here's an illustration for r = 5: Illu...
Many of you may have interacted with people from Russia on the internet at some point, and a subset of you may have noticed the slightly odd method they have of expressing themselves. e.g. удали игру нуб))) where the ))) are added for emphasis on the previous statement, I have been working on a theory that the ratio of...
Given an input string S, return truthy if all the letters in S are Lexically Ordered: their ASCII values need to be in either ascending or descending order. Return falsy in other cases. Input Input will be in the same case (all upper- or all lowercase). Your submission should be able to handle both. Input will consist...
This is a fairly simple challenge. Given a lower-case word, you must "interpolate" between letters. Here's some examples to hopefully clarify this: Input: test Output: tsrqponmlkjihefghijklmnopqrst Between letters you must add, in alphabetical order, the letters between those two letters. So if you have ad, you must ou...
Goal: Write a complete program or function which takes a formula in propositional logic (henceforth referred to as a logical expression or expression) and outputs that formula in conjunctive normal form. There are two constants, ⊤ and ⊥ representing true and false, a unary operator ¬ representing negation, and binary o...
CodeGolf Challenge PWSSHHHH! You wake up in a cryogenics lab in the year 3000. Upon being escorted to the assignment office to receive your career chip, presumably that of a delivery boy, a probe detects that you are from the year 2000. Because of this, and a few stereotypes, you are assumed stupid compared to today's ...
Pyramid Scheme is a language being developed by @ConorO'Brien. In Pyramid Scheme, the code that you write looks like this: ^ ^ / \ /3\ / \ --- / + \ ^-------^ /9\ /3\ /123\ --- ----- Now, that code has two obvious qualities: It's difficult to parse, and it's difficult...
A graphic sequence is a sequence of positive integers each denoting the number of edges for a node in a simple graph. For example the sequence 2 1 1 denotes a graph with 3 nodes one with 2 edges and 2 with one connection. Not all sequences are graphic sequences. For example 2 1 is not a graphic sequence because there ...
Definition The Alternating Power Fibonacci Sequence is formed as follows. Start with the empty sequence and set n to 1. Compute fn, the nth non-negative Fibonacci number, with repetitions. 0 is the first, 1 is the second and the third, 2 is the fourth. All others are obtained by summing the two previous numbers in the...
Your friend invited you to a high-stakes poker game at the last minute and, as a computer scientist, you've decided to use your skills to gain an edge on the game. Your task will be, given 2 cards (your hand) and 0, 3, 4 or 5 cards (the dealt cards), you must decide what the best possible hand you can get will be. If a...
Challenge: Create a program that takes input of a positive non-zero integer and outputs the 4 next numbers in the sequence described below. Note: Checking if the input is actually a positive non-zero integer is not necessary Sequence: Every number in this sequence (apart from the first, which is the input) shall be com...
The Challenge For this challenge, you are supposed to determine if a given number is in the Cantor set. So first, let's define the Cantor set. First, start with the numbers between 0 and 1. Any numbers outside this range are not in the Cantor set. Now, let's divide the numbers into three equal parts: [0,1/3], [1/3,2/3]...