instruction
stringlengths
34
53.1k
Your task is to write some code that outputs an OEIS sequence, and contains the name of the sequence in the code (A______). Easy enough right? Well here's the catch, your code must also output a second separate sequence when the name of the sequence in the code is changed to the name of the second sequence. Input Out...
In Map inputted ASCII characters, I asked you to .. map inputted ASCII characters. This time, you will do the opposite, by immediately mapping all ASCII characters, and then mapping spaces over them. This program will have practical uses, such as seeing what characters you have left in a restricted-source challenge sub...
Challenge inspiration was this that I saw somewhere: The word "nun" is just the letter n doing a cartwheel Your challenge is to take a string and determine if it is the first letter doing a cartwheel. Rules A string is a letter doing a cartwheel if: The first letter is the same as the last letter. (The letter can't ...
Oh no, I am lost on the way to finding the great treasures of Marakov! And all I have are these useless instructions that look like S10R10D30... I have no idea what they mean! Can you help me? Challenge Given directions consisting of N E S W U D L R 1 2 3 4 5 6 7 8 9 0, output how far I will be from where I started whe...
Super Mario Galaxy features two rhombicuboctahedron-shaped* planets tiled with platforms that shrink as Mario runs across. Should Mario fall into a triangular hole or a gap left by a tile he previously touched, he will be consumed by the black hole at the core. (Watch: Hurry-Scurry Galaxy, Sea Slide Galaxy) Image: Mar...
In mathematics, the factorial, shortened "fact" of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! is 1 * 2 * 3 * 4 * 5 = 120 The factorial of 0 is 1, according to the convention for an empty product. These are the regular facts we are used to. ...
In this challenge, we render Ascii user interfaces. +----------------------+ |+-----------++-------+| ||<- Previous||Next ->|| |+-----------++-------+| |== The title == | | | |Lorem ipsum dolor | |sit amet... | |+--------------+ | ||Post a comment| | |+--------------+ ...
My boss now wants me to implement a mechanism that lets him search for an item in an array, and gives him the index/indices where that value occurs. Your Task: Write a program or function that receives an array and a value (String, Integer, Float, or Boolean), and returns the indices of the array at which the value o...
This is a cops-and-robbers challenge, the robbers thread can be found here. Your task is to write some code that outputs an OEIS sequence, and contains the name of the sequence in the code (A______) and outputs a second separate sequence when the name of the sequence in the code is changed to the name of the second s...
This is a cops-and-robbers challenge, the cops thread can be found here. This is the robbers thread, your job here is to take submissions on the cops thread and try to find the hidden sequences. If you find any sequence that can be substituted into the original code to compute that sequence that is a valid crack. P...
The Sequence Everyone knows the only even prime number is 2. Ho-hum. But, there are certain even numbers n where, when concatenated with n-1, they become a prime number. For starters, 1 isn't in the list, because 10 isn't prime. Similarly with 2 (21), and 3 (32). However, 4 works because 43 is prime, so it's the first ...
A prime gap is the difference between two consecutive primes. More specifically, if p and q are primes with p <q and p+1, p+2, ..., _q_−1 are not primes, the primes p and q define a gap of n = q_−_p. The gap is said to be started by p, and to have length n. It is known that arbitrarily large prime gaps exist. That is, ...
The period of a string is the shortest non-zero shift so that the string matches itself, ignoring any parts that overhang. So for example, abcabcab has period 3. By convention we say that if there is no such shift then a string has period equal to its length. So the period of abcde is 5 and the period of a is 1. In m...
Imagine you have two lights. These lights blink on and off at a specific rate: Light 0: Delay 0ms and then blink every 1000ms Light 1: Delay 500ms and then blink every 1000ms Let's simulate these lights for the first 2000ms: 0ms: Light 0 on 500ms: Light 1 on 1000ms: Light 0 off 1500ms: Light 1 off 2000ms: Light 0 ...
Inspired by this question. Champernowne's constant is an infinite decimal number that consists of "0." followed by all natural numbers concatenated together. It begins like so: 0.123456781011121314151617181920212223242526272829303132333435363738394041424344454647484950, etc. The digits of Chamernowne's constant are se...
My little kid has a toy like this: This toy consists of 10 stackable little buckets, that we are going to number from 1 (the smallest one) to 10 (the biggest one). Sometimes he makes small piles and the toy ends up like this: We can represent schematically the piles like this: 1 6 4 9 2 7 5 10 3 8 -------...
A superior highly composite number is an integer where the ratio of its count of divisors to some power of the number is as high as possible. Expressing this as a formula: Let d(n) be the number of divisors of n, including the number itself. For a given integer n, if there exists a number e such that d(n)/n^e is greate...
Given a polynomial function f (e.g. as a list p of real coefficients in ascending or descending order), a non-negative integer n, and a real value x, return:    f n(x) i.e. the value of f (f (f (…f (x)…))) for n applications of f on x. Use reasonable precision and rounding. Solutions that take f as a list of coefficien...
(This challenge is very similar, but this current challenge has additional complications.) Imagine a 2-dimensional room, where the walls are plated with flat mirrors. Suddenly, a beam of light strikes into the room, where a piece of wall is missing! The lightbeam dances around the room, getting reflected by the wall...
I have a bunch of boards I need to stack in as small a space as possible. Unfortunately, the boards fall over if I stack them more than 10 high. I need a program to tell me how to stack the boards to take as little horizontal space as possible, without stacking boards more than ten high, or having boards hanging out ...
As described in this question: Dropsort, designed by David Morgan-Mar, is an example of a linear-time "sorting algorithm" that produces a list that is, in fact, sorted, but contains only some of the original elements. Any element that is not at least as large as the maximum of the elements preceding it is simply remov...
The Dottie number is the fixed point of the cosine function, or the solution to the equation cos(x)=x.1 Your task will be to make code that approximates this constant. Your code should represent a function that takes an integer as input and outputs a real number. The limit of your function as the input grows should b...
Task You're in charge of making a compass, of sorts. Imagine your source code as the compass "needle" where running at different orientations produces distinct output. Supported source code orientations are North, East, South, and West. Example Let's say you have source code: ABCD J K WXYZ We'll consider this the Nor...
Challenge: In the language of your choice, write a program that generates a leaderboard with random scores and outputs it, then take a new score as input and check if it can be placed in the leaderboard, and output which place it is in. Specifications: You must generate a list of 50 "random" scores, in descending orde...
We are used to the term "squaring" n to mean calculating n2. We are also used to the term "cubing" n to mean n3. That being said, why couldn't we also triangle a number? How to triangle a number? First off, let's pick a number, 53716. Position it in a parallelogram, whose side length equals the number of digits of the...
Background When you run tail -f file in bash, the file is outputted and then any subsequent appends. However, when you remove something that has already been displayed, tail outputs: tail: nameoffile: file truncated Your Challenge When given an input f, append tail: [value of f]: file truncated (with trailing & leadin...
One of my favorite mathematical pastimes is to draw a rectangular grid, then to find all of the rectangles that are visible in that grid. Here, take this question, and venture for yourself! Can you count the number of rectangles? +-----+-----+-----+-----+ | | | | | | | | | | +-----+----...
This is the cops' thread. The robbers' thread is here. Your challenge is to write a program or function that, with a certain input, prints the exact string Hello, World! and a newline. Capitalization, spacing and punctuation must be exact. Input may be taken via standard input, a file, or command-line/function argument...
This is the robbers' thread. The cops' thread is here. Your challenge is to take an uncracked submission from the cops' thread and find, for what input or inputs, the program will print Hello, World! and a newline. Capitalization, spacing, and punctuation must be exact. Please comment on the cop's submission when you'v...
Your task is to take a positive number as input, n, and output the length of the longest rep-digit representation of n in any base. For example 7 can be represented as any of the following 111_2 21_3 13_4 12_5 11_6 10_7 7_8 The rep-digits are 111_2 and 11_6, 111_2 is longer so our answer is 3. This is a code-golf ques...
September 1993 is known on Usenet as the September that never ended. Thus, for example, the day this question is being posted is Saturday, September 8740, 1993. Your program or function should take any Gregorian date (with positive year) as input and return the same date as output if it's prior to September 1993 or the...
In the beginning there was NCSA Mosaic, and Mosaic called itself NCSA_Mosaic/2.0 (Windows 3.1), and Mosaic displayed pictures along with text, and there was much rejoicing. 15 years later... And then Google built Chrome, and Chrome used Webkit, and it was like Safari, and wanted pages built for Safari, and so preten...
Note: This challenge has been moved to Polyglot the (non constant) OEIS! to avoid closure. Introduction We all know and love the on-line encyclopedia of integer sequences (OEIS). So what if we made an off-line version? Well, that would be kinda too easy, wouldn't it and how would you select a sequence with our standa...
Given a positive integer n > 1 determine how many numbers can be made by adding integers greater than 1 whose product is n. For example if n = 24 we can express n as a product in the following ways 24 = 24 -> 24 = 24 24 = 12 * 2 -> 12 + 2 = 14 24 = 6 * 2 * 2 -> 6 + 2 + 2 ...
Have you ever found a good challenge to answer, answered it and then found out somebody posted a solution with a better score in the same language? Challenge Write a program/function that takes a PPCG question ID and outputs a leaderboard. A leaderboard consists of the rank, the language, the score, the author and the ...
Reading a book is easy, but printing a book can be a bit tricky. When printing a booklet, the printer needs to have the pages arranged in a certain manner in order to be read from left to right. The way this is done is using a pattern like below n, 1, 2, n-1, n-2, 3, 4, n-3, n-4, 5, 6, n-5, n-6, 7, 8, n-7, n-8, 9, 10,...
Challenge Given the name of a PPCG member, output their PPCG ID number. If the user does not exist, you may report an error or return any non-positive number. If there are multiple members with this name, you may choose to output only one ID or all of them. Test Cases "musicman523" -> 69054 "Dennis" -> 12012 "xnor" ->...
You are the best and most famous hero of the area. Lately there have been rumors that a Hydra has been hanging out in a nearby ravine. Being the brave and virtuous hero that you are you figure you'll go check it out sometime later today. The problem with hydrae is that every time you try to cut off their heads some ne...
Task The prepend,append-Sequence is defined recursively, like this a(1) = 1 a(n) = a(n-1).n , if n is even a(n) = n.a(n-1) , if n is odd where the . represents an integer concatenation. So the first few terms are: 1,12,312,3124,53124,531246,7531246,... This is A053064. Your task is, given an integer a > 0 to return...
Background A Ruth-Aaron pair is a pair of consecutive positive integers n and n+1 such that the sum of the prime factors (counting repeated prime factors) of each integer are equal. For example, (714,715) is a Ruth-Aaron pair, since 714=2*3*7*17, 715=5*11*13, and 2+3+7+17=5+11+13=29. The name Ruth-Aaron pair was chosen...
Surprisingly, I don't think we have a code-golf question for determining if a number is semiprime. A semiprime is a natural number that is the product of two (not necessarily distinct) prime numbers. Simple enough, but a remarkably important concept. Given a positive integer, determine if it is a semiprime. Your ou...
Some two-dimensional esolangs, such as Forked, and some non-esolangs, such as Python, can sometimes require spaces before lines of code. This isn't very golfy. Also, I'm lazy and writing a 2d lang that needs lots of spaces before code. Your task is to write a tool that makes these languages golfier. Of course, this wil...
Disclaimer: The story told within this question is entirely fictional, and invented solely for the purpose of providing an intro. I am an evil farmer, and to drive up the price of wheat in my area, I've decided to burn the fields of all the farmers around me. I would really like to see the fields go up in flames (...
Oh no! There are a bunch of meteoroids on my way through the universe ... what am I and my space ship, the SP4C3, supposed to do? I need to manoeuver my shuttle through these rocks or I am done for! Your Task Write a program that guides my shuttle through a map of asteroids, using as few bytes as possible since I don't...
Background It can be shown that for any integer k >= 0, f(k) = tan(atan(0) + atan(1) + atan(2) + ... + atan(k)) is a rational number. Goal Write a complete program or function which when given k >= 0, outputs f(k) as a single reduced fraction (the numerator and denominator are coprime). Test cases The first few values ...
Inspired by this. Background The evil farmer has decided to burn your wheat field down in order to drive up the prices. To ensure total destruction, he has also soaked your field in gasoline. Even more unfortunately, you happened to be walking on the field when it was lit on fire, and you must get out quickly to surviv...
Inspired by this and this which was inspired by the first question. I've set my farmers' fields on fire, but unfortunately they saw me do it! If I don't deal with this situation they could report me and then I'd get arrested! So, that shouldn't be too hard. All I have to do is kill them with fire! The field will be an ...
The Levenshtein edit distance between two strings is the minimum possible number of insertions, deletions, or substitutions to convert one word into another word. In this case, each insertion, deletion and substitution has a cost of 1. For example, the distance between roll and rolling is 3, because deletions cost 1, ...
In this question I defined a "chain" function as a function that: is a permutation, meaning that every value maps to and is mapped to by exactly one value. and allows any value can be obtained from any other value by repeated applications of the function or its inverse. There are a lot of functions that do this and s...
Inspired by this, this and this. So, now that the evil farmer has set your field on fire, you naturally want to put it out. You have a bunch of friends who all have buckets, and you want a program to figure out where to place everyone to save as much of your wheat as possible. Your Task: Write a program or functio...
Cubically is a fairly new esoteric language capable of creating short, golf-like answers for a very specific subset of problems. It is unique in that it stores memory in the form of a 3x3 Rubik's cube, making calculations far less trivial than in most languages. In Cubically, the programmer must rotate the internal cub...
Now that we know how to properly square and triangle a number, we are going to learn how to parallelogram one. To parallelogram a number, we first arrange it as a parallelogram by stacking it on top of itself a number of times equal to the number of digits it has, and adding spaces to make it a parallelogram. So 123 ...
Inspired by this Stack Overflow question: Sorting a list: numbers in ascending, letters in descending. Your task is to solve the following problem and, as this is code-golf, you should do so in as few as bytes as possible. You should take a list of objects as input containing letters (any reasonable form: string, char,...
Given an unsigned 16-bit integer N, your task is to determine whether its binary representation mapped inside a 4x4 matrix is matching a tetromino shape, and if so, which shape it is. Matrix Each bit of N is mapped inside a 4x4 matrix, from left to right and from top to bottom, starting with the most significant one. E...
Pascal's triangle is generated by starting with 1 and having each row formed from successive additions. Here, instead, we're going to form a triangle by alternating multiplication and addition. We start row 1 with just a solitary 1. Thereafter, addition is done on the odd rows, and multiplication is done on the even r...
Given a string of ASCII letters (upper and/or lower case), output the raw MathJax required to display that string bifurcating at each character, into superscripts and subscripts. For example, the inputs cat and horse would result in outputs which MathJax renders as the following, respectively: Note that only one inpu...
My Alarm Clock I'm American, and so is my (digital) alarm clock. To set the alarm, it starts at the time it was previously. Hitting the hour button moves it up one hour, and hitting the minute button moves it up one minute. Hitting both buttons at the same time resets it to midnight (12:00 am), and counts as two button...
Lost is a 2-D programming language where the start position and direction of the ip are entirely random. This makes it very difficult to make deterministic Lost programs. However today we are not writing a deterministic program, we are writing an RNG. Write a Lost program that takes no input and outputs a single digit...
Your task is simple, write a single code snippet that when executed in one language outputs only the string 'abc' and when executed in another language outputs only the string 'cba'. The program should take no input. This is a code-golf challenge.
The usual correlation coefficient (in 2d) measures how well a set of points can be described by a line, and if yes, its sign tells us whether we have a positive or negative correlation. But this assumes that coordinates of the points can actually interpreted quantitatively for instance as measurements. If you cannot do...
Challenge description In taxicab metric, a distance between two points is defined as: Consider a matrix with only zeros and ones: 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 Let's map each 1 to the distance to nearest different 1 in the matrix (of course, assuming that distance between two adjacent rows/column...
Now that we know how to Square a Number my Way, we need an inverse operation, a way to Square Root a Number my Way. To square a number my way, you simply stack it on top of itself a number of times equal to the number of digits it contains, and then take read off every number that is formed both vertically and horizon...
Anyone here a die-hard Bethesda fan? Maybe you prefer Obsidian Entertainment? Well, if you're either of those things than the following picture should be relatively familiar to you. I've taken the liberty of preparing a rather unique ASCII-Art challenge, so here's the first clue as to what I'm going to have you do: ...
The above image displays a hexagonal grid of hexagons. Each cell in the grid is assigned an index, starting from the center and spiraling counterclockwise around as shown. Note that the grid will continue indefinitely - the above picture is simply the first section. The next hexagon would be adjacent to 60 and 37. You...
Given two positive integers, W and H, output an ASCII-art box whose border is made of slashes (/ and \) with W "spikes" on the top and bottom edges, and H "spikes" on the left and right edges. The box's interior is filled with spaces. A "spike" is simply two slashes coming together to form an arrow shape: /\ \/ / ...
There are a few questions on this site about balancing brackets, and checking whether brackets are balanced. I propose it's now time to use those balanced brackets for something! In mathematics and programming, brackets are like bubbles, isolating everything inside form everything outside so that whatever's inside can ...
Challenge Here at PPCG, we sure do like our sequences, so here's a fun another one. Let's define a(n) as being the smallest non-negative integer X that is not equal to any a(k) (0 < k < n), and a(n-1) and X do not share any decimal digits. a(0) = 0 Given an input n > 0, output such a(n). For example, for input n = 13, ...
Chebyshev Polynomials are a family of orthogonal polynomials that pop up in all kinds of places in math, and they have a lot of quite interesting properties. One characterization of them is that they are the unique polynomials that satisfy \$T_n(\cos(x)) = \cos(nx)\$. Challenge Given an nonnegative integer \$n\$, you s...
Its been a while since you killed that hydra, you basked in the glory for years, but now people are calling you washed up, a has been. Well its time you prove them wrong, you've heard the whereabouts of annother hydra. Simply kill it and you will be awarded all the glory you deserve. You arrive at the armory to recei...
Input: Two strings (NOTE: the order of input is important). Output: Both words/sentences start on lines with one empty line in between them. They 'walk' horizontally 'next to each other'. But when they have the same character at the same position, they cross each other, and then continue walking 'next to each other'. C...
Given a list of integers, your task is to output the second largest value in the first k elements, for each k between 2 and the length of the input list. In other words, output the second largest value for each prefix of the input. You can output an arbitrary value for the first element (where k = 1), or simply omit th...
Everybody knows pi the mathematical constant, the ratio of a circle's circumference to its diameter. 3.14159265358979323846264338327950288419716939937510... You probably also know e the mathematical constant, the base of a natural logarithm. 2.71828182845904523536028747135266249775724709369996... But... do you know p...
Given an input list of non-empty strings, output an ASCII art representation of a tournament, based on the following drawing rules: The number of strings is guaranteed to be of quantity 2,4,8,16,etc. The first two strings play each other, and the next two play each other, and so on. This is the first round. For each g...
Given a string S and a list of indices X, modify S by removing the element at each index of S while using that result as the new value of S. For example, given S = 'codegolf' and X = [1, 4, 4, 0, 2], 0 1 2 3 4 5 6 7 | c o d e g o l f | Remove 1 c d e g o l f | Remove 4 c d e g l f | Remove 4 c d e g f ...
The difference list of a list of integers is the list differences of consecutive members. For example the difference list of 1, 3, 2 ,4 is 2, -1, 2 Your task is to take as input a difference list and output what the difference list would look like if the original list were sorted. For example the difference list 2, 1...
Think of a road as a number line, starting at 0 and continuing indefinitely: ................................................................. There are two cars on the road: C and R. C is the cop who is trying to catch R, the robber. C starts at 0, and R starts somewhere on the road: C.............................R.....
Given a single integer x where 0 <= x <= 91 output a stack of bottles of beer with that many bottles (and shelves) missing. For simplicity sake I'll only show the first 6 bottles and what it would be for each of the first inputs. Here's the stack of bottles, each number is the bottle you should remove for that input (1...
The coefficient of relationship refers to how much DNA two persons have in common. A parent has 50% common DNA with their child (unless the parents are related), so to calculate it we have to find all pairs of directed disjoint paths starting at same node (common ancestor) and ending at each of the two siblings, and su...
Well the title says it all. Standard loopholes apply Nothing to read from stdin, and output goes to stdout 1-byte-long programs are... nonsense. They don't qualify A program with a single byte repeated is also a nonsense (like aaa) Please mark it out if your program is a palindrome Sample: A program with source code...
Define the "maximum sub-array" of a given array as "a (consecutive) sub-array that has the biggest sum". Note there's no "non-zero" requirement. Output that sum. Give a description of your code if possible. Sample input 1: 1 2 3 -4 -5 6 7 -8 9 10 -11 -12 -13 14 Sample output 1: 24 Description 1: The biggest sum is yie...
Given a list of lists find the shortest list that is a contiguous sublist of exactly one list. For example if we had [[1,2,3], [1,2,3,4], [2,4,5,6], [1,2,4,5,6]] the shortest contiguous sublist would be [3,4] since it only appears in the second list. If there is no unique contiguous sublist (this requires at least ...
Given a string as input, determine whether it is a noun or not. You will be scored on the 1000 most common English words, by how many you correctly label as a noun or not. The program or function which correctly classifies the most of those words in 50 bytes or less will win. Nouns A noun is a word that represents a th...
Two lists A and B are congruent if they have the same length, and elements that compare equal in A compare equal in B. In other words, given any two valid indices x and y: If A[x] = A[y], then B[x] = B[y]. If A[x] != A[y], then B[x] != B[y]. For example, the lists [1, 2, 1, 4, 5] and [0, 1, 0, 2, 3] are congruent. Th...
Aliens have arrived, and they aren't friendly. Turns out, they've been in the process of converting all matter in the universe into compute capability so they can have more fun in their VR simulations. Our solar system is the last bit of space they haven't converted yet, and they're about to remedy this oversight. Howe...
Given a list of positive integers, output whether every adjacent pair of integers in it shares a prime factor. In other words, output truthy if and only if no two neighboring integers in the list are co-prime. In yet other terms: given a list of positive integers [a1 a2 … an], output whether        gcd(a1, a2) > 1 && g...
The date 0409·01·MO is New Year’s Day in the Ceres Calendar. Wish everyone and everything in the Asteroid Belt, Jupiter, Saturn and beyond a belated Happy New Year by writing a program to convert Julian Dates (JD) to Ceres Dates using these helpful landmarks: JD ...
Given as input a positive integer n>=1, output the first n rows of the following triangle: 1 1 0 1 0 0 1 0 0 1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 1 1 0 1 1 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0...
Write a piece of code that takes a string as input, and outputs a piece of code in the same language that, when run, will output the initial input string. It must be able to handle any combination of characters A-Z, a-z, and 0-9. Example in Python: import sys print "print('" + sys.argv[1] + "')" Given the input of te...
Given a list of positive integers that contains at least 3 distinct entries, output a permutation of that list that isn't sorted in ascending or descending order. Examples 1,2,3 -> 2,1,3 or 3,1,2 or 1,3,2 or 2,3,1 1,2,3,3 -> 2,1,3,3 or 3,1,2,3 or 1,3,2,3 etc.. Thanks @Arnauld and @NoOneIsHere for the title!
Given a positive integer n >= 1, output the first n rows of the following structure: # # # ### # # # # # ## ## ##### # # # # # # # # # # ### # ## ## ## # ## ### ### ####### The n-th 1-indexed row is the binary representation of n, mirrored without copying the last character, with # in place of 1 a...
Many languages allow strings to be "added" with +. However this is really concatenation, a true addition would follow the group axioms: It is closed (the addition of any two strings is always a string) It is associative ( \$\forall a b . (a + b) + c = a + (b + c)\$) There is an identity (\$\exists e . \forall a . a...
Given any string, print it in the form of a triangle where the text runs up and down along each diagonal. For example, an input of "Hello World" should output: d l r d o l W r d o l o W r d ...
Write a program or function that takes in a quadratic equation and prints its factorized roots. The input can be taken in from any reasonable source, such as a function parameter, stdin, or a command line argument. Edit: This is not intended to be a duplicate of other quadratic equation questions. While others simply p...
We can define the Divisibility Streak k of a number n by finding the smallest non-negative integer k such that n+k is not divisible by k+1. Challenge In your language of choice, write a program or function that outputs or returns the Divisibility Streak of your input. Examples: n=13: 13 is divisible by 1 14 is divisib...
We define the hyper-average of an array / list (of numbers) the arithmetic mean of the sums of its prefixes. For example, the hyper-average of the list [1, 4, -3, 10] is computed in the following manner: We get the prefixes: [1], [1, 4], [1, 4, -3], [1, 4, -3, 10]. Sum each: [1, 5, 2, 12]. And now get the arithmetic m...
Given positive integer n > 2. We convert it to an array as follows: If it is equal to 2 return an empty array Otherwise create array of all n's prime factors sorted ascending, then each element replace with its index in prime numbers sequence and finally convert each element to array For example, lets convert number ...
Disclaimer: This is heavily inspired by "Polyglot the OEIS!" but fixes the problem that lead to closure (see the output section) and was re-posted as to not invalidate answers. Introduction We all know and love the on-line encyclopedia of integer sequences (OEIS). So what if we made an off-line version of the interesti...
The title is valid Jelly Code which has the same output as L€€ except printed twice. Background You can skip this section without losing ability to complete the challenge Some operations in Jelly try to convert its argument to a list first before applying the operation. One example is €, the mapping quick. This some...
As we all know, negative press covfefe has been conspiring to bring down the American president for some months now. There's also, definitely, an algorithm in play in that word. Covfe is a refreshing caffeinated beverage, and following the president's remarks it's clear the word can now be appended with successive f's ...
Many programming languages are written using solely printable ASCII, tabs and newlines. These 97 characters are then stored in 8-bit bytes (which are actually capable of holding 256 different characters!), which is just terribly inefficient - especially in code-golfing, where every byte counts! In this challenge, you w...