Given an integer N, output the Nth positive number K with the following property in decimal base:
For each digit I at position P of K, the number formed from K by removing the Pth digit (i.e. I) is divisible by I.
Example and remarks
324 is such a number:
3 divides 24
2 divides 34
4 divides ...
A field in mathematics is a set of numbers, with addition and multiplication operations defined on it, such that they satisfy certain axioms (described in Wikipedia; see also below).
A finite field can have pn elements, where p is a prime number, and n is a natural number. In this challenge, let...
In special relativity, the velocity of a moving object relative to another object that is moving in the opposite direction is given by the formula:
In this formula, v and u are the magnitudes of the velocities of the objects, and c is the speed of light (which is approximately 3.0 x 108 m/s, a...
So task is simple, given array of numbers and result, you need to find what operations you need to use on numbers from array , to obtain requested result.
Let's make it simple for start, and allow only basic operations such as: addition, subtraction, multiplication and division.
Example:
Inpu...
1) I'm not sure about the int->str->int going on, 2) there should be more elifs, 3) I'm fairly sure sum(map(int,rest)) % 3 is slower than int(rest)%3 and similarly for 7 and 9
Also delete doesn't look quite right - should it be s[:i] + s[i+1:]?
Just thinking aloud atm - e.g. for a digit of 2 you would only really need to check the last 2 digits (the last digit in most cases, the second last digit if 2 is the last digit)
There's a popular type of maths puzzle where you get a list of digits (or numbers in general) and need to insert arithmetic operators in order to reach some target number. Every single time we get a challenge around this topic, I think "this looks so familiar, we must've done this before", but th...
Note: I have a HUGE 12.2MB 10k by 20k-pixel Mandlebrot set image that I generated for over a week as my desktop background, currently giving it away, ping me if you're interested
In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence:
1
,
1
,
2
,
3
,
5
,
8
,
13
,
21
,
34
,
55
,
89
,
144
,
…
{\displaystyle 1,\;1,\;2,\;3,\;5,\;8,\;13,\;21,\;34,\;55,\;89,\;144,\;\ldots...
Okay so I've searched for this question and couldn't find it, so here goes.
The handshake problem is the classic problem that for n people in a room, if they all shake hands, what's the total number of handshakes that occur.
You code should take an input of any number and output the number of...
Javascript ES7 49 bytes
a=>a.reduce((c,d,e)=>[c**d,c+d,c-d,c*d,c/d][e%5])
Saved 9 bytes thanks to Dom Hastings, saved another 6 thanks to Leaky Nun
Uses the new exponentiation operator.
The world is identical to earth except for the above, which only started happening about 40 years ago. In addition to the miracles there are also a group of humans who have started developing telekinesis and mind reading. The miracles and spirits' strength are not limited to one particularly reli...
A hexomino (or 6-omino) is a polyomino of order 6, that is, a polygon in the plane made of 6 equal-sized squares connected edge-to-edge. The name of this type of figure is formed with the prefix hex(a)-. When rotations and reflections are not considered to be distinct shapes, there are 35 different Free hexominoes. When reflections are considered distinct, there are 60 one-sided hexominoes. When rotations are also considered distinct, there are 216 fixed hexominoes.
== Symmetry ==
The figure shows all possible free hexominoes, coloured according to their symmetry groups:
20 hexominoes (coloured...
I'm trying to generate some plots of polyhedra with coloured faces. To determine the colours, I require the adjacency information of the faces. For the 3D plot this works really well. Say I want to colour the neighbours of a given face:
adjacency = Graph[UndirectedEdge @@@ PolyhedronData["Icosah...
Title says it all. I just reviewed 3 items that already had a "Welcome to PPCG" comment. Since 2 different people had reviewed them, I assumed that they hadn't forgot to click, "I'm done".
This is similar to simplifying fractions, but with Dates!
The input of your program must be of the form mm/dd
For example
3/4 //March 4
12/15 //December 15
1/1 // January 1
We assume that the input will be valid such that the months have these numbers of days in them:
January 31
February 28
...
@NathanMerrill Has there even been a consensus yet? I don't think so, just leave a comment, because what if the user's answer was optimized for the bonus
TIL -- PowerShell [char] casting accepts integers >127 and provided that your console font supports those code points, will happily output the resultant character.
Rotate a hypercube
graphical-output geometry math ascii-art
Introduction
A hypercube/tesseract is the 4 dimensional equivalent of a normal cube. It's made by taking a cube net, extending it to the 3rd dimension, then – using the 4th dimension – folding it into a hypercube. It's basically a cub...
Chat mini-challenge -- given an ASCII string, output the product of each of it's char-codes' digit-sums. code-golf ... For example, for input "Foo" (ASCII 70, 111, 111), output 63 because [(7+0)*(1+1+1)*(1+1+1)]
After seeing that this edit suggestion got rejected because it "deviates from the original intent of the post", I realized that I have no idea why or how an edit could change the sense a post makes.
What causes edits to do so on PPCG?