@Lembik Depends how long you want to wait if there are lots of compiled entries (which a fastest code may attract...). 30 seconds sounds fine for you. The only reason to go longer is if you're interested in seeing what tricks people can do in the preprocessor
The task is as follows:
Write code that factorizes integers as quickly as possible subject to your code being no more than 140 bytes long. The output should be the list of all prime factors.
Your code can take input and give output in any way that is convenient including for example as argumen...
I have a formula, which I have no idea how to solve, because I don't know that double vertical-line sign: $\|{\rm Ax} \|$?
$${\rm x} \ne 0 \in \Bbb R^n, \quad 0 < m \le \frac {\| {\rm Ax} \|} {\| {\rm x} \|} \le M, \quad cond(A) \le \frac M m .$$
What does it mean? How should I solve this?
In linear algebra, functional analysis, and related areas of mathematics, a norm is a function that assigns a strictly positive length or size to each vector in a vector space—save for the zero vector, which is assigned a length of zero. A seminorm, on the other hand, is allowed to assign zero length to some non-zero vectors (in addition to the zero vector).
A norm must also satisfy certain properties pertaining to scalability and additivity which are given in the formal definition below.
A simple example is two dimensional Euclidean space R2 equipped with the Euclidean norm. Elements in this vector...
Ah, I read that page, but I didn't realize they were related and I couldn't understand what a norm was. So it's literally just the length of the vector?
> a norm is a function that assigns a strictly positive length or size to each vector in a vector space—save for the zero vector, which is assigned a length of zero.
@trichoplax IIRC, the taxicab distance is the shortest path moving in straight cardinal directions? (So, the sum of the distance traveled in each direction?)
@DJMcMayhem For 1, the points distance r away form a square at 45 degrees. For 2 (Euclidean) they form a circle. For higher numbers they get closer and closer to a square, with progressively less rounded corners
@DJMcMayhem You should see me when I don't have access to Wikipedia :P
@trichoplax Out of curiosity, how much do you know about linear programming? That's the real reason I'm trying to learn linear algebra right now, so I can learn linear programming
@trichoplax I'm using this library called JuMP. It's actually incredibly simple and intuitive. Very high-level way of maximizing linear equations given restraints. Like if I want to maximize x^2 + 2xy + y^2 constrained by 0 < x < 2 and 0 < y < 30, you could just automatically solve it with this:
using JuMP
using Ipopt
m = Model(solver=IpoptSolver())
@variable(m, 0 <= x <= 2)
@variable(m, 0 <= y <= 30)
@objective(m, Min, x*x + 2x*y + y * y)
@constraint(m, x + y >= 1)
status = solve(m)
CMC: Given a 2d vector (a 2 item tuple), output the difference between the 2norm and the 1norm of said vector (the difference between the distance according to the pythagorean theorem and the Taxicab distance)
I don't think so. The taxicab distance would still be 7 (3 steps negative x, 4 steps positive y), and the pythagorean distance shouldn't change cause of squaring
Should I invent a long and convoluted fake story about two people (Pythagoras and Ramanujan) travelling in their prospective taxicabs from the origin to point (a, b), and you must determine how much Pythagoras will beat Ramanujan by?
No, I mean the dimension of the space you're travelling. Because the pythogrean theorem can be extended to arbitrary dimensions, and taxicab distance is still the absolute sum of the distances
Fast inverse square root, sometimes referred to as Fast InvSqrt() or by the hexadecimal constant 0x5f3759df, is an algorithm that estimates 1/√x, the reciprocal (or multiplicative inverse) of the square root of a 32-bit floating-point number x in IEEE 754 floating-point format. This operation is used in digital signal processing to normalize a vector, i.e., scale it to length 1. For example, computer graphics programs use inverse square roots to compute angles of incidence and reflection for lighting and shading. The algorithm is best known for its implementation in 1999 in the source code of Quake...
How accurate do you need it to be? You might be able to hardcode a fixed number of iterations of finding the square root without using loops (won't be golfy though...)
House of cards
Simple challenge: given an integer, draw a house of cards with the given number of stories. If the number is negative, draw the house upside-down. Examples:
Input: 2
Output:
/\
--
/\/\
Input: 5
Output:
/\
--
/\/\
----
/\/\/\
------
/\/\/\/\
--------
/\/\/...
CMC: Given a 2d vector (a 2 item tuple), output the difference between the 2norm and the 1norm of said vector (the difference between the distance according to the pythagorean theorem and the Taxicab distance)
Haskell, 100 Bytes
f n=[h,div n h]where h=g 17(s 17);s x=mod(x*x+1)n;g a b|d>1=d|1<2=g(s a)(s$s b)where d=gcd(abs b-a)n
This works for the first 5 test cases in unnoticable time.
This will probably time-out on the second-largest test case. It will also not work on the last test case because it...
The Lenstra elliptic curve factorization or the elliptic curve factorization method (ECM) is a fast, sub-exponential running time algorithm for integer factorization which employs elliptic curves. For general purpose factoring, ECM is the third-fastest known factoring method. The second fastest is the multiple polynomial quadratic sieve and the fastest is the general number field sieve. The Lenstra elliptic curve factorization is named after Hendrik Lenstra.
Practically speaking, ECM is considered a special purpose factoring algorithm as it is most suitable for finding small factors. Currently...
Imagine travelling to a point A miles away vertically and B miles away horizontally. Or in other words, travelling from (0, 0) to point (a, b). How far would you need to end up travelling? This seems like a straightforward question, but the answer depends on who you ask. If you're a crow, and you...
I recently got access to a GTX 1080, and was hyped up to bask in its insane 9 teraflops of raw power. However, much to my surprise, my poorly optimized tensorflow code only reached a Gigaflop! Please, please help me prove that this purchase was justified.
The challenge: write the shortest progra...