Search found 3585 matches

by PM 2Ring
Fri Nov 25, 2016 8:06 am UTC
Forum: Coding
Topic: Efficiency of prime sieve
Replies: 7
Views: 3096

Re: Efficiency of prime sieve

If you're interested in storing primes, note that all primes > 30 are of the form 30n + {1,7,11,13,17,19,23,29}. There are 8 numbers in that set, so you can use a single byte to indicate all the primes in a block of 30 numbers. It's not too hard to write sieve algorithms so that they store the sieve...
by PM 2Ring
Fri Nov 25, 2016 6:12 am UTC
Forum: Science
Topic: Miscellaneous Science Questions
Replies: 2835
Views: 525764

Re: RELATIVITY QUESTIONS! (and other common queries)

As usual QM seems to be crashing the party . But at least it fixes those awful singularities and other problems. That Scharnhorst effect is interesting, but it only appears problematic if you define c to be the speed of light in a normal vacuum. If you use the more fundamental definition that it's ...
by PM 2Ring
Tue Oct 25, 2016 3:54 am UTC
Forum: Mathematics
Topic: Primes under different moduli
Replies: 4
Views: 1581

Re: Primes under different moduli

Using mod 30 is nice because you can use one byte to hold the 8 potential primes in each block of 30 numbers (apart from the first block). I wrote a segmented sieve in C using this technique many years ago, when RAM and HD space was much smaller than it is today.
by PM 2Ring
Mon Sep 05, 2016 2:56 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1729: "Migrating Geese"
Replies: 33
Views: 4837

Re: 1729: "Migrating Geese"

I was hoping for a Hardy–Ramanujan reference for this one. Oh well.
by PM 2Ring
Fri Sep 02, 2016 1:32 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1727: "Number of Computers"
Replies: 35
Views: 4941

Re: 1727: "Number of Computers"

Going sorta off topic, I've always wondered why you couldn't take radioactive waste, mix it with a lot on concrete, and pump it back into the mine it came out of (or any other conveniently depleted mine for that matter). I mean, it was just as radioactive overall before you took it out of the groun...
by PM 2Ring
Fri Sep 02, 2016 3:20 am UTC
Forum: Mathematics
Topic: How to Calculate Pi without a Calculator?
Replies: 66
Views: 6995

Re: How to Calculate Pi without a Calculator?

Yeah, I'm on my phone (and was between classes at that point), so it would be faster for you to just google "square root long division algorithm" than for me to do it and then go to the resulting page, copy the url, and try to paste it here (I say "try" because my phone often ha...
by PM 2Ring
Wed Aug 31, 2016 12:42 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1727: "Number of Computers"
Replies: 35
Views: 4941

Re: 1727: "Number of Computers"

Adjusting the frame of reference yields hurling Jupiter into the Sun. This does not particularily help. We've discussed that too. Would it be possible for humans to pollute the sun? As that thread mentions, if you could somehow collect the entire solar output for 2 billion years or so it would be e...
by PM 2Ring
Wed Aug 31, 2016 6:55 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1727: "Number of Computers"
Replies: 35
Views: 4941

Re: 1727: "Number of Computers"

What Pfhorrest said. FWIW, here's an old thread about just how hard it is to throw stuff into the Sun: Sun as final storage for radwaste?.
by PM 2Ring
Mon Aug 29, 2016 2:50 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1720: "Horses"
Replies: 55
Views: 6365

Re: 1720: "Horses"

Mahnarch wrote:I first read that as "safety feathers", and now I'm picturing a car crashing and it looking like a bird exploding from it. :D

Horse Feathers
by PM 2Ring
Sat Aug 27, 2016 6:04 pm UTC
Forum: Mathematics
Topic: Goahead52's Math Posts
Replies: 148
Views: 10168

Re: Goahead52's Math Posts

The philosopher / mathematician / poet Giordano Bruno, who promoted & extended the Copernican theory, was burned at the stake.
by PM 2Ring
Thu Aug 25, 2016 4:32 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13112
Views: 1099916

Re: Today I Learned

Today I learned: My peach tree is a nectarine tree. Peach are fuzzy. Nectarine are bald. They are the same species, fuzziness is controlled by a single allele (gene) which can signify either the fuzzy or the non-fuzzy type. The fuzzy type is dominant, so if the DNA of the tree has a pair of genes f...
by PM 2Ring
Tue Aug 23, 2016 2:23 am UTC
Forum: Mathematics
Topic: How to Calculate Pi without a Calculator?
Replies: 66
Views: 6995

Re: How to Calculate Pi without a Calculator?

A convenient way to calculate decimal digits of pi without a calculator is to use the Taylor series for arctangent with formula 24 on the Mathworld page of Machin-like formulas : pi / 4 = 8 atan(1/10) - atan(1/239) - 4 atan(1/515) This formula is nice to work with for manual calculation because of t...
by PM 2Ring
Mon Aug 22, 2016 3:50 am UTC
Forum: Language/Linguistics
Topic: Words you think English should have or bring back.
Replies: 643
Views: 105247

Re: Words you think English should have or bring back.

Why do people call their motorcycle a bike? Shouldn't they call it a moke? No, because this is a Moke. https://upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Moke02.png/280px-Moke02.png The name comes from "Mini"—the car with which the Moke shares many parts—and "Moke", which...
by PM 2Ring
Thu Aug 11, 2016 4:05 pm UTC
Forum: Mathematics
Topic: Math: Fleeting Thoughts
Replies: 377
Views: 94781

Re: Math: Fleeting Thoughts

(I promise I won't ask about properties of these constructions in non-Eucledian space :P ) Oh, in hyperbolic space it's a piece of cake. Remember that in non-Euclidean geometries the angle sum of a triangle isn't constant but instead is a linear function of the area. In hyperbolic space the sum is ...
by PM 2Ring
Wed Aug 10, 2016 2:22 pm UTC
Forum: Mathematics
Topic: Math: Fleeting Thoughts
Replies: 377
Views: 94781

Re: Math: Fleeting Thoughts

Well done, jaap!

Flumble wrote:No worries, I also know brain farts.

:) Thanks for reminding me of the Goat Problem; I've just added some diagrams to that thread.
by PM 2Ring
Wed Aug 10, 2016 2:19 pm UTC
Forum: Mathematics
Topic: Trickier problem than it seems. (goat in a circular paddock)
Replies: 19
Views: 3118

Re: Trickier problem than it seems. (goat in a circular paddock)

I've created a diagram in SVG for this puzzle. Here's the SVG code. Just save it to a file with the .svg extension and you can view it in your browser. <?xml version="1.0" encoding="UTF-8" ?><svg xmlns="http://www.w3.org/2000/svg"    xmlns:xlink="http://www.w3.org/1999/xlink"    width="400" height="...
by PM 2Ring
Sun Aug 07, 2016 2:00 pm UTC
Forum: Mathematics
Topic: Math: Fleeting Thoughts
Replies: 377
Views: 94781

Re: Math: Fleeting Thoughts

For the 3D case, the segments are unit vectors in the X, Y, and Z directions, and the oppositely-directed unit vectors -X, -Y, -Z. I think the OP is asking for the more general case where the segments are not necessarily axis-aligned. indeed (wait, am I "OP"? after 9 pages?) Ah, right. :o...
by PM 2Ring
Sun Aug 07, 2016 5:40 am UTC
Forum: Mathematics
Topic: Math: Fleeting Thoughts
Replies: 377
Views: 94781

Re: Math: Fleeting Thoughts

But does it also work for odd numbers n=2k+1>4? My gut feeling says no for at least n=5, but I can't prove it (at this time). Also, does adding dimensions have any effect? Your gut feeling is correct, and adding more dimensions doesn't help. For the 3D case, the segments are unit vectors in the X, ...
by PM 2Ring
Fri Jul 22, 2016 9:26 am UTC
Forum: Mathematics
Topic: Trickier problem than it seems. (goat in a circular paddock)
Replies: 19
Views: 3118

Re: Trickier problem than it seems. (goat in a circular paddock)

We can simplify the equation for r a little. There's a simple relation between the two angles because they are in an isoceles triangle, so we can eliminate one of the cos -1 calls. Specifically, cos -1 (1 - r 2 /2) + 2cos -1 (r/2) = π Using 1 for the radius of the field, the equation for r , the tet...
by PM 2Ring
Thu Jul 21, 2016 5:45 pm UTC
Forum: General
Topic: Thoughts for ships
Replies: 89647
Views: 5624997

Re: Random natterings

Does anyone know why Kali Linux is so popular all of a sudden? [...] Kali Linux is popular with wannabe hackers. (In the break-into-systems sense, not good coders). FWIW, the vast majority of questions from Kali users on the Stack Exchange Unix & Linux site are so abysmal that they get rapidly ...
by PM 2Ring
Fri Jul 01, 2016 8:13 am UTC
Forum: General
Topic: [SAFESPACE] LGBTIQQA Thread - Queer Support!
Replies: 8159
Views: 991888

Re: [SAFESPACE] LGBTIQQA Thread - Queer Support!

On a different topic, it strikes me that this might be a good place to ask something I was just wondering yesterday. I would like to be less hairy more often and am not really ready for big costly medical hair removal treatments or anything, but goddamn is shaving everything an enormous pain in the...
by PM 2Ring
Wed Jun 15, 2016 7:56 am UTC
Forum: Science
Topic: Relativistic Lorentz force
Replies: 34
Views: 4771

Re: Relativistic Lorentz force

It's a bit like angular momentum. There's not a completely separate 'angular momentum' from 'linear momentum', you pretty much just get angular momentum whenever linear momentum is different between two bodies; just like there's not a separate B field from the E field; and in fact the maths are som...
by PM 2Ring
Wed Jun 15, 2016 7:33 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9708
Views: 1454274

Re: Coding: Fleeting Thoughts

Incidentally, you can easily do ceiling division in Python. From http://stackoverflow.com/a/17511341/4014959

Code: Select all

def ceildiv(a, b):
    return -(-a // b)

So -a // b * -b gives the next multiple of b >= a.
by PM 2Ring
Thu Jun 09, 2016 9:46 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1691: "Optimization"
Replies: 53
Views: 6371

Re: 1691: "Optimization"

According to Wikiquote there are two versions of this remark about premature optimization in Knuth's writings. Knuth calls it "Hoare's Dictum", after fellow computer scientist Tony Hoare (inventor of Quicksort, etc), but that's just Knuth having a bit of fun. The real problem is that progr...
by PM 2Ring
Wed Jun 01, 2016 4:16 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1687: "World War III+"
Replies: 34
Views: 5198

Re: 1387: "World War III+"

@sardia

"World War III+" is actually comic #1687; comic #1387 is "Clumsy Foreshadowing".

Whatever happened to the opening post linking the thread to the comic?
by PM 2Ring
Wed Jun 01, 2016 3:58 pm UTC
Forum: General
Topic: Lucky Ten Thousand (TIL)
Replies: 13112
Views: 1099916

Re: Today I Learned

TIL: When you bleach purple hair, it turns green! I am super fascinated. I Am Not A Chemist, but I suspect that the colour change is due to a change in the oxidation state of a red pigment in the purple dye. On a (possibly) related note: In high school chemistry, I discovered that nitric acid turns...
by PM 2Ring
Mon May 30, 2016 11:29 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1685 : Patch
Replies: 40
Views: 6706

Re: 1685 : Patch

A friend of mine found a python autocomplete that evaluates your code to figure out the autocomplete, so that's kind of like compiling it? I mean I know that Python can't be compiled by definition but that the same concepts, at least. Like the vast majority of modern language implementations, all i...
by PM 2Ring
Mon May 30, 2016 9:36 am UTC
Forum: Coding
Topic: Code duplication vs clarity
Replies: 15
Views: 4043

Re: Code duplication vs clarity

Since it's first and foremost a matter of whether each piece of data is included or not, I would do an alternate version of your first suggestion using binary, like this. case = 0; if (A) case &= 1; if (B) case &= 2; if (C) case &= 4; if (D) case &= 8; if (E) case &= 16; switch ...
by PM 2Ring
Tue May 17, 2016 7:36 am UTC
Forum: Language/Linguistics
Topic: Miscellaneous language questions
Replies: 381
Views: 29707

Re: Miscellaneous language questions

"Bubbler" (with 3 syllables) was the preferred term when I was in primary school, in Sydney, Australia, several decades ago. And they were generally of the unsanitary vertical stream design. In high school, we tended to call the bubblers "the taps"; "bubbler" was a term...
by PM 2Ring
Sun May 15, 2016 5:49 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9708
Views: 1454274

Re: Coding: Fleeting Thoughts

Today I discovered the horror of bug dependencies. No, not dependency bugs, those are normal. So there was a bug report for a bug. I couldn't reproduce, but the code looked like the bug should indeed occur. I digged further and discovered three related bugs, which I fixed. Now the bug from the repo...
by PM 2Ring
Fri May 13, 2016 8:53 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1680: "Black Hole"
Replies: 31
Views: 4467

Re: 1680: "Black Hole"

Just how small is this black hole? Assuming that black spot is supposed to be the event horizon then it looks like it has a Schwarzschild radius of a centimetre or so. That's a rather heavy object to support with a regular coffee table. :) Maybe the coffee table and stand are made from unobtainium.....
by PM 2Ring
Thu May 12, 2016 11:46 am UTC
Forum: Science
Topic: How do we know what electron orbitals look like?
Replies: 8
Views: 2264

Re: How do we know what electron orbitals look like?

This article from 2005 by David Villeneuve Orbital Imaging: Laser-generated high-harmonic radiation produces tomographic images of molecular orbitals describes how to get the shape of the wave function of a molecular electron orbital. Using a computed tomography algorithm, we converted the data to a...
by PM 2Ring
Thu May 12, 2016 11:08 am UTC
Forum: Science
Topic: Which planet?
Replies: 28
Views: 4058

Re: Which planet?

@doogly: Love your work. I feel obliged to throw in a kind word for Mercury. Caloris Planitia is a plain within a large impact basin on Mercury, informally named Caloris, about 1,550 km (960 mi) in diameter.[1] It is one of the largest impact basins in the Solar System. The plain itself is about 685...
by PM 2Ring
Wed May 11, 2016 7:54 am UTC
Forum: Science
Topic: Alkaline Food
Replies: 26
Views: 4795

Re: Alkaline Food

Lutefisk is quite alkaline: pH of 11–12, although it is soaked in water before final preparation, which reduces the pH considerably.

Also, some people use lye as a seasoning. See viewtopic.php?t=96865&p=3211809#p3183323
by PM 2Ring
Sun May 08, 2016 11:54 am UTC
Forum: Mathematics
Topic: Seating problem
Replies: 6
Views: 1959

Re: Seating problem

Here's a Python 2 / Python 3 program that finds solutions. I haven't looked at Flumble's code, but I am using lorb's optimization. My approach is to express the problem as an Exact Cover problem. Our goal is to find sets of 4 permutations so that each of the 10 people get exactly 8 neighbours over t...
by PM 2Ring
Sun May 08, 2016 8:34 am UTC
Forum: Coding
Topic: [Resolved] Generalized Hamming numbers in Python
Replies: 3
Views: 2839

Re: Generalized Hamming numbers in Python

What Xanthir said, although you really only need to worry about m . Here's my version. It creates the generator expressions using a function multiples that takes i and m as args. It would work if you only pass m as an arg, but I think it improves readability to pass them both. My code doesn't use yi...
by PM 2Ring
Sat May 07, 2016 10:59 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9708
Views: 1454274

Re: Coding: Fleeting Thoughts

I'm actually going to rewrite in C++ for the performance gains. The full program may take days to run in python. Wise. I love Python, but it's not particularly fast or conservative of RAM. FWIW, in 32 bit CPython a small Python integer (i.e., one that fits into a 32 bit signed machine integer) cons...
by PM 2Ring
Fri May 06, 2016 8:08 am UTC
Forum: Fictional Science
Topic: Fiction Idea: Breaking out of the simulation
Replies: 12
Views: 4095

Re: Fiction Idea: Breaking out of the simulation

Copper Bezel wrote:
Spoiler:
Including the matryoshka doll zinger at the end. Of course, you get that with The Thirteenth Floor and Inception and all of these things, it's basically obligatory....

Spoiler:
It's turtles virtuals all the way down.
by PM 2Ring
Fri May 06, 2016 8:00 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1676: "Full-Width Justification"
Replies: 64
Views: 10390

Re: 1676: "Full-Width Justification"

YMMV, but personally I admire the documentation for FFTW , clearly written by people who have a mastery not only of their topic but of the English language too. It's direct without being overly informal, and has jokes and humorous footnotes that enhance readability without detracting from the clari...
by PM 2Ring
Thu May 05, 2016 8:16 am UTC
Forum: Individual XKCD Comic Threads
Topic: 1676: "Full-Width Justification"
Replies: 64
Views: 10390

Re: 1676: "Full-Width Justification"

My Linotype keyboarding manual talks quite a bit about justification. On a Linotype, automatic justification was achieved by adjusting the space between words with variable width spaces that would evenly divide up the space when the line was sent to cast. [...] ETAOIN SHRDLU Many years ago, I was g...

Go to advanced search