## Search found 868 matches

- Sat Dec 26, 2015 1:47 am UTC
- Forum: Mathematics
- Topic: Counting tetris arrangements
- Replies:
**2** - Views:
**1962**

### Counting tetris arrangements

So I received this lamp for xmas... https://www.thinkgeek.com/images/products/zoom/f034_tetris_stackable_LED_desk_lamp.jpg It consists of the seven Tetris pieces; the long one plugs into the wall, and the other pieces can be pushed up against it to light up. Their arrangement must be coplanar, and t...

- Thu Dec 17, 2015 3:36 am UTC
- Forum: Science
- Topic: Wendelstein 7-X
- Replies:
**43** - Views:
**8141**

### Re: Wendelstein 7-X

If the helium and the neutron carry equal kinetic energies, then their momenta will have different magnitudes.

- Tue Dec 15, 2015 3:49 am UTC
- Forum: Science
- Topic: Unbihexium density?
- Replies:
**11** - Views:
**3133**

### Re: Unbihexium density?

Incidentally, where did you get tungsten in that purity / shape? I've been looking for some in a spherish sort of form with a purity in the range of 99%, but all I can find is ultra-expensive precision-machined stuff.

- Sat Nov 28, 2015 8:12 pm UTC
- Forum: Mathematics
- Topic: Record High/Low
- Replies:
**3** - Views:
**1701**

### Re: Record High/Low

But if the distribution shifts, then the probability of a record is increased in the direction of the shift, with the net result being an increase in the total number of records — for example, the planet is warming up, so we can expect (and in fact we do observe) an excess of record highs and a dear...

- Mon Nov 16, 2015 7:13 pm UTC
- Forum: Forum Games
- Topic: Count to a Million
- Replies:
**87514** - Views:
**6279795**

### Re: Count to a Million

2 × 3 × 29 × 359

- Fri Oct 02, 2015 12:08 am UTC
- Forum: Mathematics
- Topic: Factoring numbers of the form p^x+q^y
- Replies:
**3** - Views:
**2023**

### Re: Factoring numbers of the form p^x+q^y

If both exponents are powers of 2, then we're looking at generalized Fermat numbers . If p=y and x=q , we have ourselves a Leyland number . If both exponents are 4, we're dealing with quartan numbers . I am not aware of any term that encompasses all numbers of the form you're discussing, so I'll ana...

- Mon Jun 22, 2015 2:41 am UTC
- Forum: Coding
- Topic: Happy bases
- Replies:
**12** - Views:
**3399**

### Re: Happy bases

That appears to be correct, but it's been several years since since I (briefly) studied quadratic fields, so I wouldn't go so far as to give it my seal of approval.

- Sun Jun 21, 2015 9:56 pm UTC
- Forum: Mathematics
- Topic: A Diophantine equation related to happy bases
- Replies:
**3** - Views:
**1469**

### Re: A Diophantine equation related to happy bases

I should have included the clause "in a nontrivial way" in the original claim. I'll edit that now.

- Sun Jun 21, 2015 8:02 pm UTC
- Forum: Mathematics
- Topic: A Diophantine equation related to happy bases
- Replies:
**3** - Views:
**1469**

### A Diophantine equation related to happy bases

In a thread in the coding section , notzeb stated with incomplete proof that there is a number n >1 with happy b ( n ) = n if and only if b 2 +1 is composite, where happy b ( n ) is the sum of the squares of n 's digits when written in base b . It is fairly simple to show that any solution to happy ...

- Sun Jun 21, 2015 1:33 am UTC
- Forum: Coding
- Topic: Happy bases
- Replies:
**12** - Views:
**3399**

### Re: Happy bases

notzeb wrote:This might help: ... b^2+1 can be written as the sum of a square and an odd square in a nontrivial way if and only if it is composite.

Could you explain that a bit more?

- Tue Jun 16, 2015 10:37 pm UTC
- Forum: Coding
- Topic: Happy bases
- Replies:
**12** - Views:
**3399**

### Happy bases

A happy number is defined as follows: ⋅ Given a number n , repeatedly replace n with the sum of the squares of its digits. ⋅ This will eventually reach a cycle of numbers of at most 3 digits: the cycle will either be 1 --> 1 --> 1 --> etc, or consist of number(s) greater than 1. ...

- Sun Jun 07, 2015 9:21 pm UTC
- Forum: Mathematics
- Topic: Math: Fleeting Thoughts
- Replies:
**383** - Views:
**128114**

### Re: Math: Fleeting Thoughts

Do I sense a fellow TMLT reader?

- Sun Jun 07, 2015 9:51 am UTC
- Forum: Computer Science
- Topic: Deliberately bad algorithms
- Replies:
**120** - Views:
**50098**

### Re: Deliberately bad algorithms

Could you explain that for people who don't know Haskell?

- Wed Jun 03, 2015 3:48 am UTC
- Forum: Computer Science
- Topic: Deliberately bad algorithms
- Replies:
**120** - Views:
**50098**

### Re: Deliberately bad algorithms

Or you could just bogosort the list and then extract the middle element.

Elegantly bad: deterministic primality test via trial division implemented in regular expressions. Uses O(n

Elegantly bad: deterministic primality test via trial division implemented in regular expressions. Uses O(n

^{2}) time and O(n) memory.Code: Select all

`import re`

def isprime(n): return not re.match(r'^1?$|^(11+?)\1+$', '1'*n)

- Wed Jun 03, 2015 3:36 am UTC
- Forum: Computer Science
- Topic: How efficient is the H.O.W. solution?
- Replies:
**1** - Views:
**3555**

### Re: How efficient is the H.O.W. solution?

A more common name for the HOW solution is "right hand rule". You might have better searching luck using that, but you'll want to add "maze" or something similar to the search string lest you get swamped with results about vectors. There's some discussion of this solution and oth...

- Mon Jun 01, 2015 2:57 pm UTC
- Forum: Coding
- Topic: Useful applications of recursion?
- Replies:
**19** - Views:
**4819**

### Re: Useful applications of recursion?

You mean the Euclidean algorithm? That's actually (IMO) more obvious to implement iteratively than recursively. For example, in Python we have def gcd(a, b): while b: a, b = b, a%b return a but now that I think about it, the recursive solution is a bit more elegant: def gcd(a, b): return gcd(b, a%b)...

- Mon May 25, 2015 8:07 am UTC
- Forum: Mathematics
- Topic: "Late math"
- Replies:
**1** - Views:
**1213**

### "Late math"

I'm helping put together a math circle class targeted at high-achieving middle schoolers / high schoolers concerning mathematics that was "discovered late" in the sense that deriving it requires no recently-developed apparatus. Topics of this flavor include ⋅ The pigeonhole prin...

- Tue Apr 28, 2015 2:03 am UTC
- Forum: Mathematics
- Topic: Real roots of polynomials with integer coefficients
- Replies:
**10** - Views:
**2462**

### Re: Real roots of polynomials with integer coefficients

... I'm an idiot. That was easy.

- Tue Apr 28, 2015 1:27 am UTC
- Forum: Mathematics
- Topic: Real roots of polynomials with integer coefficients
- Replies:
**10** - Views:
**2462**

### Re: Real roots of polynomials with integer coefficients

quantropy: You mention at the bottom of your page that we can ignore squarefree polynomials, but I'm not convinced that your argument for ignoring them is valid. Sure, we can divide by the repeated factors until the polynomial's squarefree, but it's plausible that the result of this division could h...

- Sat Apr 25, 2015 6:04 am UTC
- Forum: Mathematics
- Topic: Sum of sin^2(pi/n)/n
- Replies:
**2** - Views:
**1560**

### Re: Sum of sin^2(pi/n)/n

Wolfram|Alpha doesn't simplify it at all, so there's a good chance that if a closed form exists then it's rather ugly and quite hard to derive.

Incidentally, your sum has the wrong sign. It should be positive.

Incidentally, your sum has the wrong sign. It should be positive.

- Sat Apr 25, 2015 2:09 am UTC
- Forum: Mathematics
- Topic: Real roots of polynomials with integer coefficients
- Replies:
**10** - Views:
**2462**

### Re: Real roots of polynomials with integer coefficients

>-): I am quite fond of sympy, but it's even slower than mpmath, and general formulas do not exist for degree 5 and higher. jaap: That is impressively elegant. jestingrabbit: ...that makes sense. Why did I not think of that? General plan of action moving forward: 0. Linear / quadratic: use the exact...

- Fri Apr 24, 2015 10:02 am UTC
- Forum: Mathematics
- Topic: Real roots of polynomials with integer coefficients
- Replies:
**10** - Views:
**2462**

### Real roots of polynomials with integer coefficients

I'm writing some code to enumerate the real algebraic numbers. This entails root extraction, so I have a few questions in that direction. My code (Python) currently uses numpy.roots when I'm going for speed and mpmath.polyroots if I want to be precise. I don't like either package, so I'm researching...

- Mon Apr 20, 2015 3:58 am UTC
- Forum: Mathematics
- Topic: Lagrange numbers and badly-approximable irrationals
- Replies:
**2** - Views:
**1030**

### Lagrange numbers and badly-approximable irrationals

Is there a general formula for the terms of the first column in the table at Mathworld's article on Lagrange numbers ? In other words, what is the sequence of irrational numbers that are badly approximable, in descending order of badness? The right column of that table is known and stated (just appl...

- Thu Apr 09, 2015 11:28 pm UTC
- Forum: Forum Games
- Topic: The Incredible Changing Sentence
- Replies:
**5621** - Views:
**611860**

### Re: Dear Cthulhu Platonically Coveting a Rabbi.

Drat, the colorless kelpie, flashed, "my light relief!" from its belly button fabulously.

- Wed Apr 08, 2015 4:11 am UTC
- Forum: Individual XKCD Comic Threads
- Topic: 1509: "Scenery Cheat Sheet"
- Replies:
**80** - Views:
**17138**

### 1509: "Scenery Cheat Sheet"

http://imgs.xkcd.com/comics/scenery_cheat_sheet.png Title: “At the boundary between each zone, stories blend together. Somewhere in the New Mexico desert, the Roadrunner is pursued by a tireless Anton Chigurh.” The Kill Bill bit is incorrect. The desert bits were all shot in California, as evidence...

- Sun Nov 23, 2014 12:33 am UTC
- Forum: Mathematics
- Topic: [Resolved] Proving some inequalities
- Replies:
**2** - Views:
**1589**

### Re: Proving some inequalities

#1: Well that was distinctly non-obious.

#2: I am an idiot.

Thanks!

#2: I am an idiot.

Thanks!

- Thu Nov 20, 2014 6:56 pm UTC
- Forum: Mathematics
- Topic: [Resolved] Proving some inequalities
- Replies:
**2** - Views:
**1589**

### [Resolved] Proving some inequalities

I'm helping prepare a class on inequalities for a high-end high-school-level math circle. The class covers things like the Cauchy-Schwartz, Young's, Hölder's, rearrangement, Chebyshev's sum, isoperimetric, Bonnesen's, Jensen's, Bernoulli's, power mean, etc. Part of the materials will be a set of cha...

- Sat Apr 19, 2014 12:51 am UTC
- Forum: Coding
- Topic: Approximate speed classes of programming languages
- Replies:
**33** - Views:
**48422**

### Re: Approximate speed classes of programming languages

It would be interesting to see where Python interpreted via PyPy falls. Is there any data on that?

- Sun Apr 13, 2014 1:49 pm UTC
- Forum: The Help Desk
- Topic: Diagnose random freezes (Linux)
- Replies:
**9** - Views:
**4687**

### Re: Diagnose random freezes (Linux)

Concerning the video card: I will try switching drivers if it is not too complicated. By "move it to another machine and see if the crashes still occur" you mean "see if the first machine now does not crash" or "see if the second machine now crashes"? I'd find a proble...

- Sat Mar 22, 2014 3:45 am UTC
- Forum: Coding
- Topic: [Resolved] [Python] Parallel, fully independent tasks
- Replies:
**11** - Views:
**4843**

### Re: [Resolved] [Python] Parallel, fully independent tasks

concurrent.futures is actually really really good at things like this - in fact, it's basically what it exists for. It abstracts away the queue management you've coded manually (which wouldn't be needed if you didn't care about the results). I would code your case roughly like this (untested): from...

- Thu Mar 20, 2014 2:14 am UTC
- Forum: Coding
- Topic: [Resolved] [Python] Parallel, fully independent tasks
- Replies:
**11** - Views:
**4843**

### Re: [Python] Parallel, fully independent tasks

@wumpus: Thanks! That was quite helpful. My code is now def multifactor(n): # Note that the multiprocessing incurs overhead to the tune of 0.1s. # This is generally negligible compared to the time to factor the sort of numbers this is fed # and the time already spent in the first two phases of the f...

- Tue Mar 18, 2014 10:35 pm UTC
- Forum: Coding
- Topic: [Resolved] [Python] Parallel, fully independent tasks
- Replies:
**11** - Views:
**4843**

### Re: [Python] Parallel, fully independent tasks

Of course it gives parallelism! That's what the whole threading and multiprocessing modules are for!

- Tue Mar 18, 2014 6:29 pm UTC
- Forum: Coding
- Topic: Suggest an open-source C/C++ IDE
- Replies:
**22** - Views:
**7390**

### Re: Suggest an open-source C/C++ IDE

What about Geany?

- Tue Mar 18, 2014 11:39 am UTC
- Forum: Coding
- Topic: [Resolved] [Python] Parallel, fully independent tasks
- Replies:
**11** - Views:
**4843**

### [Resolved] [Python] Parallel, fully independent tasks

I'm writing a function in Python to factor large numbers by running several algorithms in parallel (Pollard's Rho algorithm, Lenstra's elliptic curve method, and the multiple-polynomial quadratic sieve. I've defined those as pollardRho() , ecm() , and mpqs() . Each takes the number to be factored as...

- Sat Feb 22, 2014 3:33 am UTC
- Forum: Mathematics
- Topic: Math: Fleeting Thoughts
- Replies:
**383** - Views:
**128114**

### Re: Math: Fleeting Thoughts

The 48 known Mersenne primes have exponents 2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701, 23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433, 1257787, 1398269, 2976221, 3021377, 6972593, 13466917, 20996011, 24036...

- Thu Jan 30, 2014 2:44 pm UTC
- Forum: General
- Topic: You can't prove a negative : why, logically?
- Replies:
**25** - Views:
**5554**

### Re: You can't prove a negative : why, logically?

Or you could mix it with pastry and honey to get baklava.

There's a joke about balaclava in there somewhere, but I can't figure out how to structure it...

There's a joke about balaclava in there somewhere, but I can't figure out how to structure it...

- Fri Dec 20, 2013 5:46 am UTC
- Forum: Coding
- Topic: Bugs popping up only under optimization
- Replies:
**25** - Views:
**7656**

### Bugs popping up only under optimization

I've been around programming long enough to have heard horror stories of code that does exactly what it's supposed to when fed into a plain compiler but, when compiled with -O2 or -O3 enabled, starts misbehaving. I have not been around programming long enough to have actually encountered such code. ...

- Thu Dec 19, 2013 5:26 am UTC
- Forum: Coding
- Topic: [done] Translating Mathematica to Python
- Replies:
**7** - Views:
**4855**

### Re: Translating Mathematica to Python

eta oin shrdlu wrote:I think your lineCode: Select all

`if a*x == r+y and a >= minden*x:`

should beCode: Select all

`if a*x == r+y and a >= minden:`

But the original Mathematica code has minden * x instead of just minden...

... huh. That did the trick. I'm declaring this problem solved. Thanks!

- Thu Dec 19, 2013 3:44 am UTC
- Forum: Coding
- Topic: [done] Translating Mathematica to Python
- Replies:
**7** - Views:
**4855**

### Re: Translating Mathematica to Python

divisors(1368857880324) takes less than half a second on my computer. I accidentally submitted my previous post after the first sentence. Here's the rest: Also---the code has now been more-or-less translated and simply laughs at the 4-minute benchmark (which was set way back in 1996), computing Egy...

- Thu Dec 19, 2013 3:06 am UTC
- Forum: Coding
- Topic: [done] Translating Mathematica to Python
- Replies:
**7** - Views:
**4855**

### Re: Translating Mathematica to Python

I'll eventually submit this code to SymPy, so I'm using their built-in divisors method.