instruction
stringlengths
34
53.1k
Given two positive integers A and B, return the position p that minimises the number of prime factors (counting multiplicities) of the resulting integer, when B is inserted in A at p. For example, given A = 1234 and B = 32, these are the possible insertions (with p being 0-indexed) and the corresponding information abo...
Note: The title of this question should be "Loop It", but because title needs to be at least 15 characters, there are some invisible spaces. This note is such that the challenge can be searched for. Challenge Given a finite list of unique integral points in the plane, find a polygon whose vertices are exactly those...
Given a German string and an indication of a case (lower/upper/title), fold the string to that case. Specifications Input will consist only of a–z plus äöüß-,.;:!?'" in uppercase and/or lowercase. The target case may be taken as any three unique values (please specify what they are) of a consistent type; either three ...
A positive integer x is a square triangle number iff there are two different positive integers, y and z, which are smaller than x such that all of the sums x + y x + z y + z are perfect squares. For example 30 is a square triangle number because 30 + 6 = 62 30 + 19 = 72 6 + 19 = 52 Your task is to write some code that...
Lonely primes (as I call them) are primes, where given a number grid with width w ≥ 3, are primes which do not have any other primes adjacent to them orthogonally or diagonally. For example, if we take this grid where w = 12 (primes highlighted in bold): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17...
Definition An "integer triangle" is one with integer coordinates. For example the following triangle is an integer triangle: (0, 0), (0, 1), (1, 2) with perimeter 1 + sqrt(2) + sqrt(5) ≈ 4.650. Task The goal of this challenge is to count all integer triangles (up to congruence) with perimeter less than n. Input and Ou...
Challenge Write a program that takes an 11x11 array of integers, and constructs a 3D ASCII block building, where each value in the array represents the height of a column of blocks at the coordinates matching the array position. A negative height is a "floating" column - only the top block is visible. Example ...
Your task is to write a RoboZZle interpreter. If you're not familiar with the game, please watch the video at robozzle.com or read my description below. A robot lives on a rectangular grid of squares coloured red, green, blue, or black. Black squares are inaccessible. The others are accessible and some of them contain ...
Given no input, output this interesting alphabet pattern in either case (the case has to be consistent) via an accepted output method: A AB ACBC ADBDCD AEBECEDE AFBFCFDFEF AGBGCGDGEGFG AHBHCHDHEHFHGH AIBICIDIEIFIGIHI AJBJCJDJEJFJGJHJIJ AKBKCKDKEKFKGKHKIKJK ALBLCLDLELFLGLHLILJLKL AMBMCMDMEMFMGMHMIMJMKMLM ANBNCNDNENFNGN...
Challenge There are many numbers which can be expressed as the difference of two squares, or as the difference of two cubes, or maybe even higher powers. Talking about squares, there are various ways of writing a number, say 75, as the difference of 2 squares. You can write: 75 = (10)^2 - (5)^2 = (14)^2 - (11)^2 ...
Challenge Suppose you have a list of numbers, and a target value. Find the set of all combinations of your numbers which add up to the target value, returning them as list indices. Input and Output The input will take a list of numbers (not necessarily unique) and a target summation number. The output will be a set of ...
You know what a palindrome, a prime and a date are. Your task is to list all dates in 100 thousands of years that fulfill all three characteristics. Nevermind anything but the numbers, use the following formats: YYYYMMDD and YYYYYMMDD. Dates between 0000-01-01 and 9999-12-31 should be printed as 8 digit palindrome...
Originally the Multiplicative digital root Challenge Basically do what the title says Method Given a positive integer 1 <= N <= 100000000 through one of our standard input methods, multiply every digit together, ignoring zeroes. Ex: Take a number, say 361218402: 3 * 6 = 18 18 * 1 = 18 18 * 2 = 36 36 * 1 = 36 36 * 8 =...
Background Based on a game my four-year-old got from his rabbi. The "goal" is to "find" the letters in a given order, e.g. aecdb. You are given a stack of letter cards, e.g. daceb. You can only search through the stack in the order given, albeit cyclically. When you meet a letter you need, you take that out of the stac...
Your challenge is to write a program to solve a 3x3x3 Rubik's Cube. This challenge is based on this one from 2013, rewritten to adhere to current community standards, and reposted with the original author's permission and help on meta. Input The input should represent an unsolved Rubik's Cube. You may read this input v...
Background A matryoshka doll (or Russian nesting doll) is a set of dolls that fit inside of each other. I've accidentally mixed up my collection of matryoshka dolls and I don't remember which one goes inside which. Objective Given a list of unique strings, sort them into nested matryoshka dolls. Each string is an indiv...
Is there a better way to calculate the number of leap years between two given years? I want to make my code shorter (in Python). Do you have any suggestions? Here is my solution: i=int r=raw_input t=i(r()) while t: b,d=map(i,r().split()) c=0 for y in range(b,d+1): if y%400==0 or y%4==0 and y%100:c+=1 print c t-=...
You may or may not remember Xeyes, a demo program that came with (and, as far as I know, still comes with) the X window system. Its purpose was to draw a pair of eyes that followed your mouse cursor: Your challenge is to recreate Xeyes with ASCII art. Write a program or function that draws two ASCII art eyes (specifie...
Two numbers are considered amicable if the proper divisor sum of the first is the same as the second number, the second number's proper divisor sum is equal to the first number, and the first and second numbers aren't equal. \$s(x)\$ represents the aliquot sum or proper divisor sum of \$x\$. 220 and 284 are amicable be...
Prior to the decimalisation of Sterling in February 1971, a pound (£ - from Roman libra) comprised 20 shillings (s - solidus), each of 12 pennies (d - denarius). Additionally, until 1960, each penny could be divided into four farthings (some parts of the Commonwealth also had fractions of farthings, but we'll ignore t...
There is a site called "Return True to Win" with interesting tasks for Javascript programmers. The goal is to find arguments to a given function that force it to return true. The following is one of the tasks: function total(x) { return (x < x) && (x == x) && (x > x); } The users must find snippets for the value of ...
quintopia has posted here a challenge to compute multinomial coefficients (some of the text here is copied from there). There is a fun algorithm to compute multinomial coefficients mod 2. Given a list of numbers, k1, k2, ... ,km, output the residue of the multinomial coefficient: reduced mod 2. The following algorith...
When multiplying monomials in the Milnor basis for the Steenrod algebra, part of the algorithm involves enumerating certain "allowable matrices". Given two lists of nonnegative integers r1, ... ,rm and s1, ... ,sn, a matrix of nonnegative integers X is allowable if The sum of the jth column is less than or equal to...
Definition The rank of a word is defined as the position of the word when all the possible permutations (or arrangements) of its letters are arranged alphabetically, like in a dictionary, no matter if the words are meaningful or not. Let us consider these two words - "blue" and "seen". To begin with, we would write all...
Today in my statistics class, I found that some factorials can be simplified when multiplied together! For example: 5! * 3! = 5! *3*2 = 5! *6 = 6! Your job: Given a string containing only Arabic numbers and exclamation points, simplify my factorial to its shortest possible string, in the least amount of bytes for your ...
This is inspired by the excellent Visualize Visual Eyes challenge. It is posted with permission from and credit to @Jordan We are going to create an ASCII art approximation of the Xeyes challenge but without worrying about the actual mouse movements. Just the positions. EDIT I thought about whether this could be seen a...
The majority function is a boolean function which takes three boolean inputs and returns the most common. For instance if maj(x,y,z) is the majority function and T denotes true and F denotes false then: maj(T,T,T) = T maj(T,T,F) = T maj(T,F,F) = F maj(F,F,F) = F This question concerns writing boolean functions as comp...
Objective Given a 2D array of any size, write a program or function to shift alternatively the columns and rows Example a b c d e f g h i j k l m n o All elements in the first column shift down one row, the second column shift up one row, the third shift down one row and so on, wrapping when they reach the edge. k g m...
Background Here you have another work-inspired challenge, but from my wife's work in this case. Imagine you have a service that returns the list of nodes in a tree structure (much like the files and folders in a file system), but in no particular order. For every node you get a tuple with its name and the name of its p...
Room Number Locator I have come across an interesting problem solving technique at my job when given the wrong room number from a colleague for a meeting. Every now and then, while on the way to a meeting, a member on my team will send me the wrong room number, typically because they are in a rush at their desk and fat...
The objective of this challenge is to take an array of positive integers, and enumerate its indices, grouping like elements. An enumeration without any duplicates is done by just outputting an array of pairs (value, index), for example, [3, 4, 13, 9, 2] => [[3,1],[4,2],[13,3],[9,4],[2,5]]. However, if a given element a...
Introduction In this challenge your task is to generate the ISBN-10 code for books given its ISBN-13 code, assuming that such a code exists. Such an ISBN-13 code consists of several parts separated by -: 978-GG-PPPP-TTT-C The letters G (group), P (publisher), T (title) and C (checksum) all stand for one digit. For the...
Take a square matrix containing positive integers as input, and calculate the "rotated sum" of the matrix. Rotated sum: Take the sum of the original matrix and the same matrix rotated 90, 180 and 270 degrees. Suppose the matrix is: 2 5 8 3 12 8 6 6 10 then the rotated sum will be: 2 5 8 8 ...
Write a function or program that, when given a list of names, outputs or returns a list where duplicates of given names have a unique shortened version of their surname. Input: A list of names, where a name is defined by a given name and a last name separated by a space. Names are non-empty strings containing only upp...
Inspired by a polyglot on the Stack Overflow 404 page: Goal Your goal is simple, to create a polyglot that outputs the number 404, and then terminate, in as many languages as possible. Restrictions Here's the twist, there's a restriction to make it harder: You have to write N programs and pick N languages in a particu...
Background Many people visit webpages, which require special browsers because of lack of compatibility. So you have to write a script (client sided or server sided), which just prints the name of the browser. Because not everyone has fast internet, the script has to be as short as possible. (This is a joke xD) Rules Y...
Recently I had the pleasure of writing a Haskell program that could detect if the NegativeLiterals extension was engaged. I came up with the following: data B=B{u::Integer} instance Num B where{fromInteger=B;negate _=B 1} main=print$1==u(-1) Try it online! This will print True normally and False otherwise. Now I had ...
Inspired by this Math.SE question. Background The Fibonacci Sequence (called F) is the sequence, starting 0, 1 such that each number (F(n)) (after the first two) is the sum of the two before it (F(n) = F(n-1) + F(n-2)). A Fibonacci Sequence mod K (called M) is the sequence of the Fibonacci numbers mod K (M(n) = F(n) % ...
The sequence contains the decimal representation of the binary numbers of the form: 10101..., where the n-th term has n bits. The sequence is probably easiest to explain by just showing the relationships between the binary and decimal representations of the numbers: 0 -> 0 1 -> 1 10 -> 2 101 -> ...
Challenge: Given an index integer n, either output the n'th item in this sequence, or output the sequence up to and including index n: 25,25,7,28,29,20,21,22,23,14,35,26,7,28,29,20,16,29,12,15,28,21,14,17,30,13,16,29,12,15,28,21,10,6,12,18,15,11,7,13,19,17,13,9,15,21,18,14,10,16,22,19,15,11,17,23,20,16,12,18,24,21,17,1...
Given two different lists of non-negative integers, return the list that has the highest maximum (e.g. [4, 2], [3, 3, 1] -> [4, 2]). If they both have the same maximum, return the list that contains more instances of this maximum (e.g. [4, 2, 4], [4, 3, 3, 3, 1, 3] -> [4, 2, 4]). If, after these comparisons, they are e...
Inspired by the fourth problem from BMO2 2009. Given a positive integer n as input or a parameter, return the number of positive integers whose binary representations occur as blocks in the binary expansion of n. For example, 13 -> 6 because 13 in binary is 1101 and it has substrings 1101, 110, 101, 11, 10, 1. We do no...
Given a list of hole yardages, green sizes, a slice angle and a max distance, compute a golf score. Assumptions Earth is flat All greens are circular Slice angle will be between -45 and 45 degrees and will be given in degrees All distances in the same metric (yards or meters, doesn't matter) No out of bounds, obstruct...
This question asking us to make a "Cyclic Levenquine" has gone unanswered. So today we will ask a slightly simpler version. In this challenge we will define a K-Levenquine to be a program whose output is Levenshtein distance K from its source. Task Your goal in this challenge is to write a program with some output dif...
Your challenge is to translate a Cubically cube-dump to the format specified in this challenge. Input The input will represent a Rubik's Cube, formatted how Cubically prints its memory cube at the end of every program. This is a solved cube: 000 000 000 111222333444 111222333444 111222333444 555 555 5...
Sometimes to fall asleep, I'll count as high as I can, whilst skipping numbers that are not square-free. I get a little thrill when I get to skip over several numbers in a row - for example, 48,49,50 are all NOT square-free (48 is divisible by 2^2, 49 by 7^2, and 50 by 5^2). This led me to wondering about the earliest ...
Your challenge is simple. Write two programs that share no characters which output each other. Example Two programs P and Q are mutually exclusive quines if: P outputs Q Q outputs P There is no character c which belongs to both P and Q Each program P and Q are proper quines This counts empty quines and quines that re...
Inspiration. Given (by any means): A two-argument (or single argument consisting of a two-element list) black box function, f: ℤ+ × ℤ+ → ℤ+ (input and output are 1, 2, 3,…) A strictly positive integer matrix with at least two rows and two columns return the matrix's function trace. What is a function trace? A normal ...
Challenge The challenge is to write a program that takes the coefficients of any n-degree polynomial equation as input and returns the integral values of x for which the equation holds true. The coefficients will be provided as input in the order of decreasing or increasing power. You can assume all the coefficients to...
UBASIC is a freeware basic interpreter written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing. It is considered to be a "ready-to-run" language that and is capable of running on DOS and Windows. What general tips do you have for golfing in uBasic? Any ideas that can be applied to cod...
What general tips do you have for golfing in Clean? Please post only ideas that can be applied to code golf problems in general, and are at least somewhat specific to Clean. If you've never heard of Clean, you can find out more here. Or, you can join the chat room.
Challenge: Input: Three integers: bottom-edge length; starting amount of grains of sand; index Output: Output the state of the bottom part of an hourglass at the given index, based on the given bottom-edge length and amount of grains of sand. Challenge rules: We simulate the grains of sand with digits 1-9 We put the c...
Try to create a simple ASCII art scissors animation! Challenge All inputs will be integers -31 through 31. The output will be an animation (To be outputted somewhere, as long as the previous frame is replaced. GIFs are allowed.), separated by (approximately) 1 quarter of a second. If the input (n) is positive: The ani...
Introduction Try to convert words to two different unicode fonts. Challenge Your task is to transform your input string into the and unicode characters. All uppercase words should become lowercase words. For Example: WORD -> All lowercase words should become words For example: other words -> All mixed ...
Introduction Output all the numbers in specific base that would appear in an adapted version of the game of seven. Challenge Your task is to output all the numbers in a given base in a given range, skipping the ones matching certain conditions. You will be given four inputs: base elim start and end. The roles of the f...
Specification This challenge is simple to state: your input is a non-empty array of nonnegative integers, and your task is to partition it into as few substrings as possible, such that each substring is a permutation of a consecutive integer range. More formally, if the input array is A, then the output is minimum numb...
Input is an r by c matrix of non-negative integers (you may input r and c as other parameters if this helps with golf). This may be inputted as a 2D array or, if you prefer, a 1D array (though taking in r this time is necessary). Strings separated by spaces to distinguish rows and newlines to distinguish columns are al...
Story So I have a book that I want to separate from my table with nothing but other books. I want to know how many books do I need to achieve this with \$n\$ book lengths. Here's a visualization that my friend at Wolfram drew for me: More information about the topic in Wolfram and Wikipedia. Challenge Given an integer...
Introduction Suppose you have a list of lists of integers (or any objects really, but let's stick to integers for simplicity). The lists may be of different lengths, and some of them may be empty. Let's write the lists in a tabular format: [[ 1, 2, 3, 4, 5], [ 6, 7], [ 8, 9, 10, 11], [], [12, 13, 14...
Introduction Your goal is to find the least number of ones you need to add or multiply together to get the input value, this is A005245. Input One positive integer N. Output The smallest number of ones that must be added/multiplied to get N. Sample Input 7 Sample Output 6 Explanation (1 + 1 + 1) * (1 + 1) + 1 = 7 ...
Hexcells is a game based off of Minesweeper played on hexagons. (Full disclosure: I have nothing to do with Hexcells. In fact I don't really like the game.) Most of Hexcells rules can be pretty easily expressed in Generalized Minesweeper (Minesweeper played on an arbitrary graph). The one that is most difficult is th...
Introduction The Boids Algorithm is a relatively simple demonstration of emergent behavior in a group. It has three main rules, as described by its creator, Craig Reynolds: The basic flocking model consists of three simple steering behaviors which describe how an individual boid maneuvers based on the positions and ve...
A radiation-hardened program is a program where, if any character of the code is removed, the program will still function the same. For this question, we'll be writing a program that detects when it is irradiated. Write a program or function that, when any single byte is removed, the resulting program will output that ...
A positive integer can be diluted by inserting a 0 between two bits in its binary expansion. This means that an n-bit number has n-1 dilutions, which are not necessarily all distinct. For example, for 12 (or 1100 in binary), the dilutions are 11000 = 24 ^ 11000 = 24 ^ 10100 = 20 ^ In this challenge, we're goin...
Introduction Write a solver for the Hitori puzzles using least bytes. Challenge Your task is write a solver for the Hitori (ひとり, the word for "alone" in Japanese; the meaning of the game name is "Leave me alone") logical puzzles. The rules are as follows: You are presented with a n-by-n grid of cells, each cell contai...
Introduction Given a set of text-based "screenshots" consisting of printable ASCII chars merge them so that all of them form one long screenshot so that nobody has to do it themselves when reading it. Challenge Take input as a list of strings (referred to as "screenshots"). Each screenshot consists of several lines of ...
Given a string as input find the longest contiguous substring that does not have any character twice or more. If there are multiple such substrings you may output either. You may assume that the input is on the printable ASCII range if you wish. Scoring Answers will first be ranked by the length of their own longest ...
Introduction This challenge is similar to Project Euler problems. I came up with it because I was playing a deceivingly simple board game and couldn't come up with an efficient solution to answer a simple question about its mechanics. Quarto is a fun variant of 4 in a row. It is played on a 4 by 4 board with 16 unique ...
Challenge Write a program that compresses and decompresses ASCII text losslessly. It should be specialized to work well with palindromes, including case-insensitive and punctuation-insensitive palindromes. The best compression with the smallest source wins. Scoring total_bytes_saved / sqrt(program_size) - Highest score...
Your challenge is to expand some brackets in a program's input as shown: Find a string s between two matching brackets [ and ], with a single digit n after the closing bracket. Remove the brackets. Replace s with itself repeated n times. (If n is 0, simply remove s.) Go to step 1 until there are no more matching brack...
Input: A matrix containing integers in the range [0 - 9]. Challenge: Determine if all non-zero elements are connected to each other vertically and/or horizontally. Output: A truthy value if all are connected, and a falsy value if there are non-zero elements/groups that aren't connected to other elements/groups. Test ca...
This challenge is from an admission test to a closed number cyber security course. Anyway it doesn't have to do with cyber security, it's just to test the students logical and coding skills. Task Write a program that removes entries from an array so that the remaining values are sorted in a strictly decreasing order an...
Apparently yes! In three easy steps. Step 1 Let f(n) denote the prime-counting function (number of primes less than or equal to n). Define the integer sequence s(n) as follows. For each positive integer n, Initiallize t to n. As long as t is neither prime nor 1, replace t by f(t) and iterate. The number of iterations ...
As computer scientists, you're probably all familiar with the basic list operations of pop and push. These are simple operations that modify a list of elements. However, have you ever heard of the operation flop? (as in flip-flop)? It's pretty simple. Given a number n, reverse the first n elements of the list. Here's a...
Definition The maxima and minima of a given function are the largest and smallest values of the function either within a given range or otherwise within the entire domain of the function. Challenge The challenge is to find the local maxima and minima of a given polynomial function using any method you may like. Don't w...
As we saw in this question complex logical statements can be expressed in terms of the simple connectives of generalized Minesweeper. However Generalized minesweeper still has redundancies. In order to avoid these redundancies we define a new game called "Generalized-1 Minesweeper". Generalized-1 Minesweeper is a vers...
Your task is to model the effects of batter on pieces of food. Please add three layers of crust. [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0], // in [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0], [0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0], [0,0,0,0,0,0,0,0...
Task Given a list of integers L and another integer s, the goal is to compute the column-wise sums of all s-length (potentially overlapping) slices of L, while pertaining their positions relative to L (see below). Definitions The s-length (overlapping) slices of the list L are all the contiguous subsequences (without w...
Notice: I'm willing to give a bounty to any answer that I find interesting. Your challenge is to design a Turing-complete one instruction set computer (OISC): An OISC is an abstract machine that uses only one instruction – obviating the need for a machine language opcode. With a judicious choice for the single instruc...
A Russian nesting doll, more commonly known as a Matryoshka doll, is a doll which contains a smaller version of itself, which then contains another smaller version of itself, which contains a smaller version of itself, which contains a smaller version of itself, which contains a smaller version of itself... - until fi...
Your assignment is to write a program of even length, that prints an ASCII-art square (described below), that increases its side length by 1 unit each time the original source code is pasted in the middle of the current code. It is quite hard for me to define this task very well, so I'll give you an example: Let's sa...
Weather forecasting: Wrong too often to rely on, right too often to ignore. Given a high and low temperature and one of four weather conditions per day, output an ASCII-art graphical five day weather forecast. The structure of the four graphical indicators are shown below. \ / -O- Sunny / \ \ / -O(==) ...
We are doing a PCG challenge at work, and I'm submitting answers in C#. This is a modification of the "M'Kay" challenge. My solution has been deemed correct by the requirements, I'm just trying to shrink it further if possible. A filler word is an apparently meaningless word, phrase, or sound that marks a pause or h...
Given n=m^2, return a list of integers that do not border the m x m grid of integers from 1 to n. Examples n=1 (m=1) Grid: [1] Return: [] n=4 (m=2) Grid: [1,2] [3,4] Return: [] n=9 (m=3) Grid: [1,2,3] [4,5,6] [7,8,9] Return: [5] n=16 (m=4) Grid: [ 1, 2, 3, 4] [ 5, 6, 7, 8] [ 9,10,11,12] [13,14,15,16] Return: [6,...
Your challenge is to implement a cyclic Program Sequence Generator (PSG) in a language of your choice. Given a language, L, a PSG in L is a program in L that outputs a PSG in L. Some properties of a PSG are: Repeated execution of a PSG in L generates a sequence of programs in L. A PSG is said to be cyclic if the seque...
Normal brackets ((),[],<> and {}) are nice and unambiguous, however someone thought it would be a good idea to use non bracket characters as brackets. These characters, | and ", are ambiguous. For example does """" correspond to (()) or ()() It is impossible to tell. Things start to get interesting when you mix ty...
This challenge was originally sandboxed by Magic Octopus Urn; I adopted and posted it with his permission. This is the cops' thread. The robbers' thread is here. The challenge Step One: Write a piece of code (function or full program) which checks for primality. Step Two: Remove pieces of your code by replacing charac...
This is the robbers' thread. The cops' thread is here. Your challenge is to take an uncracked submission from the cops' thread and try to find the original unredacted program. Please comment on the cop's submission when you've cracked their code.
Challenge The challenge is to write a code that takes a positive integer 'n' as an input and displays all the possible ways in which the numbers from 1 - n can be written, with either positive or negative sign in between, such that their sum is equal to zero. Please remember that you may only use addition or subtractio...
It's annoying when you have to search for a language homepage, get its link, and add it to your SE comment/answer, right? Let's write a script to do that for you! Challenge For each language name (intentional or not) in the input, replace it with the markdown link to the language home page, defined by TIO. Rules (impo...
Challenge For this challenge, a mountainous string is one that conforms to the grammar rule M: x(Mx)* where at each production, the all x's are the same character. When indented, a mountainous string might look something like this: A B C D C E F E C B A As you can see, it looks a bit like a mounta...
The brethren from the order of St Golfus the Concise have a tradition of reciting a short prayer whenever they see someone make the sign of the cross. Due to the high level of sin measured among tourists recently, they have installed CCTV in the monastery, and they've hired you to help them keep old tradition alive in ...
Challenge Given a real number as input, calculate the number of times which the natural logarithm function ln can be applied to it before the resulting number becomes imaginary. Explanation Applying ln to a negative number results in a non-real number. This means that, by repeatedly applying ln to a number, you will ev...
There are n places set around a circular table. Alice is sat on one of them. At each place, there's a cake. Alice eats her cake, but it doesn't taste very nice. Then the Mad Hatter comes in. He gives Alice a list of n-1 numbers, each between 1 and n-1. For each item i in the list, Alice has to move around i places and ...
Triangularity is a new esolang developed by Mr. Xcoder where code structure has to follow a very specific pattern: For the nth line of code, there must be exactly 2n-1 characters of the program on it. This causes a triangular/pyramid shape, with the first line having only one character and the rest increasing by inc...
Quylthulg is a language by Chris Pressey that attempts to solve the problem of infix notation using what it calls panfix: like postfix, panfix does not require the deployment of arcane contrivances such as parentheses to override a default operator precedence. At the same time, panfix allows terms to be specified in t...
Haskell has this neat(-looking) feature where you can give it three numbers and it can infer an arithmetic sequence from them. For example, [1, 3..27] is equivalent to [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27]. That's cool and all but arithmetic sequences are fairly limiting. Addition, pfft. Multiplication's ...
Given the following input: An integer n where n > 0. A string s where s is not empty and s~=[0-9A-Z]+ (alpha-numeric capitals only). Using a standard, simplified QWERTY keyboard (as shown below): 1234567890 QWERTYUIOP ASDFGHJKL ZXCVBNM Perform the following operation: Find the original row that each character is in...
Last month I borrowed a plenty of books from the library. They all were good books, packed with emotions and plot-twists. Unfortunately, at some points I got very angry/sad/disappointed, so I tore some pages out. Now the library wants to know how many pages I have torn out for each book. Your goal is to write a program...
On PPCG, we have had lots of challenges where the length of your output is dependent on the length of your source code. For the purposes of this challenge, we will call these Source-length problems. The two most well known examples of source-length problems are Output with the same length as the code (the 1X source-l...