instruction
stringlengths
34
53.1k
Description There have been quite a few other challenges concerning these numbers before, and I hope this one is not among them. The n th triangular number equals the sum of all natural numbers up to n, simple stuff. There are a wikipedia page and an entry at OEIS, for those who wish to inform themselves further. Now, ...
Help! I just logged into Stack Exchange, but I forgot what my password is! I need a way to work it out before I log off. Luckily, I'm an excellent hacker. Not only was I able to find my password's hash, but I also found Stack Exchange's hashing algorithm! It takes the ASCII value of each digit multiplied by that digit...
We define a prime character as a character that has a prime ASCII value. We define a prime string as a String that only contains prime characters. Given a String that only contains printable ASCII, determine whether that String is prime. Input / Output You can take input either as a String or as a list of individual c...
Let's see how good your language of choice is at selective randomness. Given 4 characters, A, B, C, and D, or a string of 4 characters ABCD as input, output one of the characters with the following probabilities: A should have a 1/8 (12.5%) chance to be chosen B should have a 3/8 (37.5%) chance to be chosen C should h...
Challenge Given an integer in 32-bit two's complement format, return the index of the second least-significant zero digit in the binary representation, where an index of 0 represents the least significant bit, and an index of 31 represents the most significant bit. If there is no second zero, you may return 0, any nega...
Description We consider an integer with at least 3 digits triple-balanced if, when split into three parts, the digits in every part sum up to the same number. We split numbers as follows: abcdefghi - Standard case: the number of digits is divisable through 3: abc def ghi abcdefgh - Number % 3 == 2: The outer groups ar...
As we all know, it's turtles all the way down. But is it primes all the way down too? A number is considered a "turtle-prime" if it satisfies the following conditions: 1) It is prime. 2) It is possible to remove a single digit leaving a prime number. 3) Step 2 can be repeated until left with a single digit prime. For ...
Many of us are familiar with the game Tron. You control a "lightcycle" placed on a grid. The lightcycle always moves forward (though you control the direction) and leaves a permanent trail behind it. If you run into a trail, you crash! The goal here is to determine if a given path is a valid loop, that is, it returns t...
I noticed that there's no such question, so here it is: Do you have general tips for golfing in x86/x64 machine code? If the tip only applies to a certain environment or calling convention, please specify that in your answer. Please only one tip per answer (see here).
One problem on a website like this is that you often don't know if you are talking to a male or female. However, you have come up with a simple NLP technique you can use to determine the gender of the writer of a piece of text. Theory About 38.1% of letters used in English are vowels [a,e,i,o,u] (see References below, ...
Given a non-negative integer or a list of digits, determine in how many ways can the number be formed by concatenating square numbers, which may have leading zeroes. Examples input -> output # explanation 164 -> 2 # [16, 4], [1, 64] 101 -> 2 # [1, 01], [1, 0, 1] 100 -> 3 # [100], [1, 00], [1, 0, 0] 1 -> 1 # [1] 0 -> 1 ...
The infinity symbol is also called a lemniscate. Your program must draw a lemniscate with text via standard out (formatted with newline feeds) or graphically. The infinity symbol (by my standards) must be continuous (that is, every non-whitespace character must be touching two other non-whitespace characters diagonally...
Problem Given input a where a is a grid of characters in any input format as long as it has only one element for each 'block' of the output. And input b where b is a grid of numbers the same size as input a. There are two types of road, a 1 represents a stone road marked by @ and a 2 represents a dirt road marked by # ...
Description A Caesar Shift is a very simple monoalphabetic cipher where each letter gets replaced by the one after it in the alphabet. Example: Hello world! -> IFMMP XPSME! (IBSLR, EGUFV! is the output for the actual challenge, this was an example of shifting by 1.) As you can see, spacing and punctuation remain unatt...
Drunk Uncle (sorry M.E. and AUS for region lock) is a fictional character from Saturday Night Live. He often confuses words for others that sound like them. For this challenge you need to convert normal speech into drunkspeak. Algorithm Translating to drunkspeak requires swapping the order of words in the text. Swappin...
There is a Sioux village. It has a totem: __ ___| |___ \/ \ / \/ /\ ``| |`` /\ /^^\ | | /^^\ / /\ \ | | / /\ \ '''''''''''''''''''''''''''' The totem lets the Sioux mastering the weather for helping in their different tasks. Help the villagers p...
I'm honestly surprised that this hasn't been done already. If you can find an existing thread, by all means mark this as a duplicate or let me know. Input Your input is in the form of any positive integer greater than or equal to 1. Output You must output the sum of all integers between and including 1 and the number i...
These are the hosts of the "Weekend Update" news segment on Saturday Night Live, with the years they hosted and their initials: Chevy Chase 1975-1976 CC Jane Curtain 1976-1980 JC Dan Aykroyd 1977-1978 DA Bill Murray 1978-1980 BM Charles Rocket 1980-1981 CR Gail Matthius 19...
To "shift" over a number n places, do the following: Remove the last n digits Add n copies of the first digit to the beginning of the number For example, to shift the number 31415 three places, take out the last three digits to get 31, and then add three more copies of the first digit, 3, to the end, giving 33331. If...
This is a tips question for golfing in Python, which is on topic for main. I'm looking for the shortest way to get all of the most common elements of a list in Python, in the shortest way possible. Here's what I've tried, assuming the list is in a variable called l: from statistics import* mode(l) This throws an error...
Inspired by this comment... Thanks to users Step Hen, Wheat-Wizard, and Dennis for helping my solidify the specification of this challenge before posting it! This is the Cops' thread. For the Robbers' thread, go here In this challenge, you are tasked with running some code that makes it so that your language no longer...
Inspired by this comment... Thanks to users Step Hen, Wheat-Wizard, and Dennis for helping my solidify the specification of this challenge before posting it! This is the Robber's thread! For the Cops' thread, go here In this challenge, you are tasked with running some code that makes it so that your language no longer...
Introduction Classically, booleans are one bit; true or false, 1 or 0. Leading zeros would just be redundant. For example, 001 means the same as 00001 or just 1. The 32-bit boolean Given a truthy/falsey value, output the equivalent 32-bit boolean as a string. (Or as a number if for some reason your language supports l...
Simple challenge: try to output the following text in as few bytes as you can: the answer toli fetheuniv ersea nde ver ything the ans wer tol ife the uni ver sean dev ery thin gth ean swer tolifetheuni ver seandeveryth in...
Problem Build an octal calculator that can do the following operations: Add (+) Subtract (-) Multiply (*) Divide (/) Check is prime Counting in octal is like this with decimal (Octal) (Decimal) 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 10 8 11 9 and so on.....
I need to call my friends but the buttons of my cordless phone are not working properly. The only buttons I can press are [Up], [Down] and [Call]. [Up] and [Down] can be used to navigate in my recent calls and [Call] can be used to call the selected name. My phone has a list that holds N recent calls, and I know that a...
We are all familiar with the famous Fibonacci sequence, that starts with 0 and 1, and each element is the sum of the previous two. Here are the first few terms (OEIS A000045): 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584 Given a positive integer, return the closest number of the Fibona...
Basic rules (different from mine) Story It is the year 4579, humans now have 2 hands with 1001 fingers each. Chopsticks has become based off of points. And @Dennis has more rep then @Martin... Hand drawn red circles are now downvoted... Jon Skeet has hit 2 trillion rep on every SE site... Yeah scary I know Chopsticks i...
(based on this post and the ensuing discussion on chat -- also, much thanks to Dennis for TIO!) The Challenge Choose a language that's currently available on the TryItOnline site, for example PowerShell. Write code in that language on that page, that doesn't take any input, such that when the Run button is clicked, the...
Let's say you have some text, and you want it to send it to your friend, but you don't want anyone else to read it. That probably means you want to encrypt it so that only you and your friend can read it. But, there is a problem: you and your friend forgot to agree on an encryption method, so if you send them a messa...
Description: A non-integer representation of a number uses non-integer numbers as the bases of a positional numbering system. e.g. Using the golden ratio (the irrational number 1 + √5/2 ≈ 1.61803399 symbolized by the Greek letter φ) as its base, the numbers 1 to 10 can be written: Decimal Powers of φ Base φ...
Challenge Take a number and output it with 4 digits or less using letters and numbers. For example; 270,030 would turn into 270K. Key Billion -> B Million -> M Thousand -> K Rules You may choose to accept input numbers that include commas delimiting every three decimal places (such as 123,456,789). Round to nearest, h...
The challenge is to find a string of characters that cannot appear in any legal program in your programming language of choice. That includes comments, strings, or other "non-executable" parts. Challenge Your program may be specific to a particular version or implementation of your language's compiler/interpreter/runt...
Goal Given an input number, round it off to the nearest number with one significant figure. Requirements Input A floating point number. Assume the input number results in an output within the data type's limits (ie. ignore overflow errors.) 0 is an invalid input. Numbers that cannot be accurately represented in the fl...
Write a function that takes a string of letters and spaces (no need to handle non-letters) and performs the ANNOUNCER VOICE translation algorithm as follows: First, uppercase everything. For each word, Elongate each consonant cluster by tripling each letter; except, if the word begins with a consonant cluster, do no...
Using the following length-separated lists of words: https://github.com/Magic Octopus Urn/wordListsByLength Print 1 word from each list of length n from 1 all the way up to 20, here's a valid example: a an and hand hands handle handles abandons abandoned understand outstanding newfoundland understanding characteristic...
Let's say we have a n × n lattice; we can then divide the lattice into two sections by drawing a line through the lattice. Everything to one side of the line is in one set and everything else in another. How many ways can we divide the lattice in the manner? For example lets take a 2 × 2 lattice: . . . . We can make ...
Thanks to HyperNeutrino for making more test cases Often in chat, someone will ask a question, and multiple people will answer it at the same time. Usually, the person who was beaten to the gun will say "ninja'd", creating even more unnecessary chat. Given a chat log similar to the following: Community: Hi Test: Hi Ran...
According to me, a tornado looks like this: ######## ####### ###### ##### #### ### ## # This tornado starts out with width n, and on each next line, a character is removed from either the left or the right, depending on the input. Input The input will be a list of some sort of any two unique values (...
There have been a billion iterations of Fibonacci challenges on this website, so lets spice things up with a Fibonacci challenge of a billion iterations! Your challenge is to output the first 1000 decimal digits of the 1,000,000,000th Fibonacci number with as short a program as possible. This may then optionally be fol...
In my answer, I have this code: s.match(/[AEIOU]/) This seems too verbose to check if a string is one of A, E, I, O, or U. I tried: "AEIOU".includes(s) But that's 1 byte longer. Can I do this in a shorter way?
Imagine a straight river and a road that goes across the river n times through bridges. The road does not loop on itself and is infinitely long. This road would be considered an open meander. An open meander is an open curve, that does not intersect itself and extends infinitely at both ends, which intersects a line n ...
The Challenge Your task is to create a program that takes any given string input, and outputs the input in a squared format. Empty strings should return an empty string. Examples Given the input: golf Your program should output: golf o l l o flog Input: 123 Output: 123 2 2 321 Input: a Output: a Input: Hello, w...
No, not that thing in powerpoint You will be given a string, and a 2D array of boolean values. The 2D array will represent a picture. You will be creating art out of it. Let me show you how. The steps to art First, you create a square which fits the 2d array, with the string. Like if the string is 'PPCG', and the pic...
This is similar to Making an acronym, but there are several key differences, including the method of fetching the acronym, and this challenge including flexible output. Task Given a string (list of chars/length 1 strings is allowed) containing only printable ASCII, output all capital letters in the input that are eithe...
(Despite 60+ questions tagged chess, we don't have a simple n-queens challenge.) In chess, the N-Queens Puzzle is described as follows: Given an n x n chessboard and n queens, arrange the queens onto the chessboard so that no two queens are threatening each other. Below is an example solution for n = 8, borrowed from W...
Let us define a sequence. We will say that \$a(n)\$ is the smallest number, \$x\$, that has the following properties: \$x\$ and \$n\$ are co-prime (they share no factor) \$x\$ does not appear earlier in the sequence \$|n - x| > 1\$ Unlike most sequences the domain and range of our sequence are the integers greater t...
As of 13/03/2018 16:45 UTC, the winner is answer #345, by Khuldraeseth na'Barya. This means the contest is officially over, but feel free to continue posting answers, just so long as they follow the rules. As well, just a quick shout out to the top three answerers in terms of numbers of answers: 1. NieDzejkob - 41 ans...
Inspired by this challenge (thanks @cairdcoinheringaahing for the title!), your task is to take two printable ASCII strings and multiply them element-wise with the following rules. How does it work? Given two strings (for example split and isbn) you will first, truncate the longer one such that they have equal length a...
Cubically is too tedious to manually write any code in. Your challenge is to translate ASCII text into Cubically source code. Cubically This is just a quick run-down of Cubically; the repository has a more complete guide and details. Cubically is an esolang I wrote a while ago, designed to be painful to use. It contain...
Given an integer n ≥ 1, output a 2D representation† of a percent sign of width n. The construction goes as follows: Create an n by n matrix (or list of lists) filled with zeroes. Insert ones in the top-left and bottom-right corners. Place ones on the diagonal from the bottom-left to the top-right. For input n = 4, th...
Challenge Write the shortest program that, when compiled or executed, produces a fatal error message smaller than the program itself. The error message may not be generated by the program itself, such as Python's raise. A valid answer must include both the code and the error message. Shortest valid answer wins. No erro...
Challenge Given a list of integers, return the list of these integers after repeatedly removing all pairs of adjacent equal items. Note that if you have an odd-length run of equal numbers, one of them will remain, not being part of a pair. Example: [0, 0, 0, 1, 2, 4, 4, 2, 1, 1, 0] First, you should remove 0, 0, 4, 4,...
This challenge is as follows. (Uhoh no! Now everyone is going to use reciprocal division. Now all the answers are going to look the same and lose originality, ugh!) Given two integers multiply them, ... but you can't use the multiplication symbols "*" and "x". As you probably know multiplication is just an extension...
A curve is a set of points on a square grid such that each point has exactly two neighbors in the four-neighbor neighborhood and the points form a single connected component. That is, the graph induced by the points on a grid graph is isomorphic to a single cycle. "Induced" means that two points cannot touch in the inp...
This challenge is pretty simple: Your task is to draw a schematic of a (simplified) memory array. You will be given two (positive) integers n,m and the task is to draw the n:2^n decoder connected to the memory array with d data lines. The addressing will be in the order of gray codes, to check if the sequence is correc...
For this challenge you need to make a given word by concatenating "pieces" (a.k.a contiguous substrings) from other words. Given a word and a list of words as input, output the fewest number of pieces needed to create the first word. Rules Words consist of characters in the ASCII range 33 to 126. The word list may ha...
Given a single positive odd integer as input, return a converging zigzag as a list of strings, list of lists of characters, or newline-separated string, in this form: # # # # # # # # # # # You can replace # with any consistent non-whitespace character. Trailing whitespace on each line is allowed...
You will be given a String consisting of printable ASCII (without newlines). Your task is to build a nice Stairway for my Castle. How to build a nice Stairway? First off, you should get all the rotations of the String. For example, the String abcd has the following rotations: abcd, bcda, cdab, dabc (each character is ...
Given a string containing only letters (case-insensitive), split it into words of uniformly random lengths, using the distribution below, with the exception of the last word, which can be of any valid length (1-10). Your output is these words, as a space-separated string ("test te tests"), an array of strings (["test",...
Watch live | Active answers | Add new answer | Chat room | Source code | Leaderboard New tournaments whenever needed. New players and new updates very welcome. Not actual game footage. Each player starts with one ant - a queen, who collects food. Each piece of food can be held or used to produce a worker. Workers also...
Lets define a class of functions. These functions will map from the positive integers to the positive integers and must satisfy the following requirements: The function must be Bijective, meaning that every value maps to and is mapped to by exactly one value. You must be able to get from any positive integer to any o...
Your task today is to apply a wave to an array of numbers. A wave looks like this: [1, 0, -1, 0, 1, 0, -1, 0, 1...] Applying it to a given array means adding together the first elements, the second elements, etc. More precisely: Your program or function will receive an array of integers. It must print or return an equa...
A Sphenic Number is a number that is the product of exactly three distinct primes. The first few Sphenic numbers are 30, 42, 66, 70, 78, 102, 105, 110, 114. This is sequence A007304 in the OEIS. Your Task: Write a program or function to determine whether an inputted integer is a Sphenic number. Input: An integer be...
Challenge Given a set T of subsets of a finite set S={1,2,3,...,n}, determine whether T is a topology or not. Explanation The powerset P(S) of some set S is the set of all subsets of S. Some examples: S = {}, P(S) = {{}} S = {1}, P(S) = {{}, {1}} S = {1,2}, P(S) = {{}, {1}, {2}, {1,2}} S = {1,2,3}, P(S) = {{}, {1}, {2}...
You and your friend want to send each other secret messages. However, because you are conspiracy theorists and think that the government has a quantum computer that can crack any standard encryption. Therefore, you are inventing one of your own. The first step of this is as follows: taking an input string, you check...
Input: A non-empty list / vector where each element holds a value/character, indicating if you'll count up or down. I'll use 1 and -1, but you may choose whatever you like. You can only use two values, you can't use 1,2,3... and -1,-2,-3..., for up and down respectively. Challenge: You'll use the numbers in the geomet...
Challenge HP is doing research in mathematics . After doing lots of research, she struck in a problem . She found four numbers n,a, b and c .Now, She wants to know how many number exists which are less than or equal to n and are divisible by a ,b or c . Input : 4 integers denoting n,a,b and c separated by space Output ...
An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p±2, that are both prime. You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin ...
Last Thursday user @SpookyGengar delighted us with his/her first challenge about Making Squared Words. What if we double the number of sides? The challenge Take a string as input in any reasonable format you need (string, char array...) and output an octogonal representation of the input (also in any reasonable format:...
Given an array of positive integers in base 10, where n > 0, output their representation of a binary wall. How does this work? Convert each number to its binary representation. Pad the representation with leading zeroes to the length of the longest one i.e. 1, 2 -> 1, 10 -> 01, 10. Create a wall where the 1s are brick...
(inspired by Helka's response to my random pairing of "chess" and "Fibonacci" tags in chat) Fibonacci The Fibonacci numbers are one of the more well-known sequences in mathematics, where each number is composed by adding the two previous numbers together. Below is a definition of the zero-indexed sequence: f(0) = 0 f(...
This is the cops' thread. The robbers' thread is here. Your challenge is to make a program that runs forever without halting1, unless it gets a particular input or inputs2. If it receives that input, it must terminate in a finite amount of time3. This is code-golf, so the shortest answer that has not been cracked by a ...
This is the robbers' thread. The cops' thread is here. Your challenge is to crack a cop's submission by finding an input that makes it halt. You don't have to find out why, or all inputs that make it halt if there's more than one, or the input the cop intended, just one input will do. Once you have cracked a submission...
Your program should take an array as input. The array: Will always be 1 dimensional Will only contain integers Can be empty The program should reverse the array, and then add up the elements to the original for example: Input: [1, 2, 3] Original: [1, 2, 3] Reversed: [3, 2, 1] [1, 2, 3] + + + [3, 2, 1] [1+3, 2+2,...
Program the shortest code that will calculate the average BPM (Beats per Minute) using 8 data points of time passed. This is my first post, and I haven't seen a question similar to this. Since I am a fan of rhythm games, it would be nice to have a small handy tool to calculate BPM using your own keyboard and your own s...
Your challenge is to generate this string: 0110101101011010011010110101101011010110101101001101011010110100110101101011010110101101011010011010110101101001101011010110101101011010110100110101101011010000110101101011010011010110101101011010110101101001101011010110100110101101011010110101101011010011010110101101001101011...
Given a string that is potentially boxed in, toggle the box. This becomes clearer in the test cases and explanation. Input / Output Input Format The input will be either a single string separated by CR, LF, or CRLF, or a list of strings. The input format is up to you to decide. Output Format The output format must be i...
All the quine challenges on this site are focused on byte count, or the characters themselves. This one is different. Your challenge is to write a program that produces output which has a code point sum identical to the source's code point sum. To produce a code point sum: Find the values of the characters in the prog...
The challenge Quite simple, given an input x, calculate it's infinite power tower! x^x^x^x^x^x... For you math-lovers out there, this is x's infinite tetration. Keep in mind the following: x^x^x^x^x^x... = x^(x^(x^(x^(x...)))) != (((((x)^x)^x)^x)^x...) Surprised we haven't had a "simple" math challenge involving this...
(related) A Pythagorean Triple is a list (a, b, c) that satisfies the equation a2 + b2 = c2. A Primitive Pythagorean Triple (PPT) is one where a, b, and c are all coprime (i.e., the only common divisor between the three elements is 1). For example, the (3, 4, 5) right triangle is a famous Primitive Pythagorean Triple. ...
On puzzling SE there are what are called "matchstick problems" in which math is written in match sticks and you are allowed to move a certain number of them to get a certain property. In this question we will be considering only integers represented in a 7-segment display format. Here are all 10 digits in that format:...
Fortress was a language being developed by the Sun Programming Language Research Group (R.I.P. Fortress) that had a unique property to it, it was possible to render ("Fortify") programs in different font-styles (i.e. blackboard bold, bold, italics, roman, etc. ). The goal is to represent a one-char Fortress variable in...
Related: Tell me how many math problems I have to do! Challenge Given a strictly positive strictly ascending integer list L and an integer 3 ≤ N ≤ length of L, replace the middle integers of L's consecutive integer runs of length ≥ N with a single dash -. Rules Horizontal whitespace is irrelevant. You may optionally p...
You are working as an intern for a mathematician who really hates TeX, LaTeX, etc. So much so that he has decided to abandon all typesetting whatsoever and make you do all the formatting in ASCII. You got tired of this after a while and decided to start automating parts of it, starting with square roots. Here's how a s...
I majored in computer science in the area of communication technologies and I fluently speak Python, Java, C, Bash, Matlab, Octave and some others. But you guys know things I have never ever heard about like "Fish" or "R" or "Whitespace" or some kind of crazy things. Sometimes these languages are not even build by ASCI...
Motivation In this challenge your task was to multiply two strings, this naturally introduces a way to take the square root of a string. How does it work? Given a string (for example pub) the first thing you need to do, is to determine the ASCII code for each character: "pub" -> [112, 117, 98] Next you map these codes...
Your challenge is to make a program(less number of bytes than what the below program takes) that should print the map of India with any special character of choice. TIO Link #include <stdio.h> int main() { int a = 10, b = 0, c = 10; char* str = "TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq " "TNn*RP...
In the physical world, invisible ink usually becomes invisible when it dries, and is then is readable if it is exposed to heat or chemicals of some kind. The invisible ink in this challenge will be readable when exposed to highlighting. Create a full program or function that takes in text from the console (using a prom...
\$P_k(n)\$ means the number of partitions of \$n\$ into exactly \$k\$ positive parts. Given \$n\$ and \$k\$, calculate \$P_k(n)\$. Tip: \$P_k(n) = P_k(n−k) + P_{k−1}(n−1)\$, with initial values \$P_0(0) = 1\$ and \$P_k(n) = 0\$ if \$n \leq 0\$ or \$k \leq 0\$. [Wiki] Examples n k Ans 1 1 1 2 2 1 4 ...
(inspired by a question over on Code Review) Suppose two people are playing Hangman, but you've only overheard the game and want to draw the current status. Given two words as input, where the words each match [A-Z]+ or [a-z]+ (your choice), output the current state of the hangman game as ASCII art, following the below...
I was playing around with cellular automaton and I found one that had some interesting behavior. Here's how it works: It reads a binary string from left to right, if it encounters a 1 followed by 2 other values it will append a 0 to the result and continue reading. If it encounters a 0 (or there are less than 3 value...
Given the coordinates of the centres and the radii of 2 circles, output a truthy value of whether they do or do not overlap. Input Input may be taken via STDIN or equivalent, function arguments, but not as a variable. You can take them as a single variable (list, string etc) or as multiple inputs / arguments, in whate...
Four-In-A-Row AI Tournament Today, we will be playing a Four-In-A-Row tournament. However, it is not us humans playing... instead, we must have our computers battle instead! This challenge is completely in C#. Rules Basic Game Rules If you have never played, there are simple rules. 2 players take turns putting pieces i...
Challenge Given a matrix M with r rows and c columns, and two Boolean lists V of length r and H of length c, calculate the partitioned cumulative vertical and horizontal sums. Rules r and c are greater than or equal to one H and V begin with a true value The values in M are within your language's reasonable numeric do...
This question is similar to Do the circles overlap?, except your program should return True if the circumference of one circle intersects the other, and false if they do not. If they touch, this is considered an intersection. Note that concentric circles only intersect when both radii are equal Input is two x, y coordi...
A company is arranged in a heirarchical structure, with a layer of workers at the bottom. Each worker is managed by a manager. Consequently, each manager is managed by another manager until there is a company "boss". Each manager is restricted to managing, at most, x workers. For a company of size y calculate the numbe...
Inspiration. Inverse. Evaluate a given omnifix expression. Omnifix is like normal mathematics' infix notation, but with additional copies of each symbol surrounding the arguments. The outer symbols take the place of parentheses, and there is therefore no need for additional parentheses. You must support addition, subtr...
The following is the rhombus sequence. 1 121 12321 1234321 123454321 12345654321 1234567654321 123456787654321 12345678987654321 Your task is to output this, taking no input and using standard output methods (STDOUT, list of numbers or list of strings, etc.). There's a hitch. You may only use up to one loop - no neste...
In base-10, all perfect squares end in \$0\$, \$1\$, \$4\$, \$5\$, \$6\$, or \$9\$. In base-16, all perfect squares end in \$0\$, \$1\$, \$4\$, or \$9\$. Nilknarf describes why this is and how to work this out very well in this answer, but I'll also give a brief description here: When squaring a base-10 number, \$N\$, ...