Archive for the ‘Uncategorized’ Category

Primaility fun

Monday, September 11th, 2006

Okay, so I’m in the process of writing several tools to manipulate prime numbers (in between moving, doing my paying work, working on music, packing, and several other projects, so it’s mostly been slow going)

My goal: To find a equation that given prime P, will find the next prime Q, less expensively than having to factor. Yes, I know this is a fool’s errand. But I generally need a problem to give me a excuse to learn anything, and this is helping me learn about number theory.

(And yes, I do intend to return to my fusion research at a later date, and yes, I am still working on the car, and yes, I do understand that I have a problem with working on too many projects at once)

(To put it mildly)

Actually, here’s my current active projects list, in no particular order

0) Work
1) Two songs for my mother
2) Get back bass guitar ability
3) Pack
4) Move
5) Unpack
6) Prime number research
7) Battery pack exchange on car
8) BMS software R3

Another indicator that we live in a f***ed up world

Sunday, September 3rd, 2006

The wikipedia has a operating budget of about $1.2 million a year – and they currently are reporting a $160k shortfall.

The corperation for public broadcasting is whining because they have had their budget cut from $400 million to $300 million.

Okay, I love PBS, but…

For blank’s sake.. $300 million dollars in government funding, plus all of the private and corperate funding.. and, if you all haven’t noticed, PBS basically runs ads just like any other broadcast system, they just call them ‘thanking our sponsers’.. well, okay, if you all want to kid yourselves like that..

The wikipedia! has! no! ads!. It offers information which may be biased or incorrect, but at least has a better chance of maybe bearing some resemblence to the truth than any other encyclopedia compiled to date. And they’ve got a budget shortfall, when their total budget is probably less than PBS spends on their fancy window offices.

Why can’t the U.s. government just kick a couple of million dollars over to the wikipedia people? Kind of, you know, eliminate any worry that they might not be able to keep the lights on next year?

Actually, it occurs to me that a mostly unbiased forum for collecting knowledge might be considered a bad thing by the current administration. Maybe even a very bad thing.

But I’m going to try and put on my optimism hat and hope everything comes out for the best.

In the meantime, I’m donating everything I would have put into politics this month into the wikipedia instead. Probably do more good there.

SQL database of primes

Sunday, September 3rd, 2006

So, I’m generating a SQL database of the first million primes as part of one of those random side tangents that I go off on occasionally. So far I’m up to half a million, and I’ve made several optimizations. I don’t know that my primefinder is actually valid, so I’m including it for you all to critique:

#!/usr/bin/perl

# version: 0.06
$debug = 1;

use DBI;
use Time::Local;

$dbh = DBI->connect(“dbi:mysql:db=primes”,undef,undef) || die “Failed to connect to database”;

$SIG{INT} = \&shutdown;

# first, locate our current position

($current) = $dbh->selectrow_array(“SELECT loc FROM current_location”);

$counter = $current;

#$lastprime = 1;

($lastprime) = $dbh->selectrow_array(“SELECT MAX(prime_number) FROM primes”);

$counter = ($lastprime + 1) if($lastprime > $counter);

while(1) {

if(is_prime($counter)) {
$span = $counter – $lastprime;
$lastprime = $counter;
log_prime($counter, $span);
print “$counter ($span)\n” if($debug);
}

if(! ($counter % 1000)) {
$dbh->do(“UPDATE current_location SET loc = $counter, ts = now()”);
}

$counter++;

}

sub is_prime {

my $number = shift;

# could use much improvement

return 0 if ($number == 1);
return 0 if (($number != 2) && (($number % 2) == 0));

# $maxprime = (int($number / 2) + 1);
$maxprime = (int(sqrt($number)) + 1);

# test against all known primes thus far

$sth = $dbh->prepare(“SELECT prime_number FROM primes WHERE prime_number < $maxprime"); $sth->execute();

while(($pp) = $sth->fetchrow_array()) {
# return 0 if(($number != $pp) && (int($number / $pp)) == ($number / $pp));
return 0 if(($number != $pp) && (($number % $pp) == 0));
}

$sth->finish();

return 1;
}

sub log_prime {
my $number = shift;
my $span = shift;

$dbh->do(“INSERT INTO primes VALUES (NULL,$number,$span,now())”);
}

sub shutdown {

$dbh->do(“UPDATE current_location SET loc = $counter, ts = now()”);
exit(0);
}

Nuts.

Friday, September 1st, 2006

Fun little page I found:

http://www-groups.dcs.st-and.ac.uk/~history/HistTopics/Prime_numbers.html

Is it a bad sign that as I get older, I increasingly enjoy things like this?

Grr grr

Wednesday, August 30th, 2006

According to the tail end of http://en.wikipedia.org/wiki/Flash_memory, this article is ‘too technical’. Personally, I think it’s just the right amount of technical – any less technical and it wouldn’t get all of the ideas across. Chances are if you’re looking up flash memory specifically, you’re not scared by technical details. The wikipedia people shouldn’t scare away their more technical authors, IMHO.

Oh well. Nothing’s perfect.

you all will be pleased to know…

Wednesday, August 23rd, 2006

that my backup of my laptop completed with 0 errors.

Boy, do I feel sheepish..

Tuesday, August 22nd, 2006

1) The location to download WinZip 9 is in the FAQ.
2) My laptop seems to be backing up happily. Just to be sure, though, I will try to avoid using it until the backup completes.
3) I have got to do something about my negative attitude.

Tuesday, August 22nd, 2006

This day just gets better and better – I set the date forward on the wintel I’m using temporarily while my laptop is backing up, and it now will not run the WinZip eval version. So, I grab my winzip unlock code that I actually purchased from WinZip, and type it in.. and no dice. Oops, it was for V9.

Go to look for V9 on the web.. and it’s not there, except from people I wouldn’t download from on a bet. Winzip took it down to force people to buy V10, apparently.

Fight the urge to program my fax machine to send them 10,000 faxes saying ‘You Suck’.

Email their tech support. We’ll see what they say.

Tuesday, August 22nd, 2006

I gave up smoking many months ago, but this is one of those times when I really wish I had a cig.

My computer has gotten further along the backup process this time, and hasn’t crashed yet, but I’m chewing on my fingernails hoping that this situation continues. Currently, it’s estimating the job at about 4 hours. I have a somewhat slower but still acceptably fast Wintel desktop that I just fixed a few days ago that I can use instead.. although the focus on the monitor is nowhere near as good as the laptop – I wish that my super-hyper-excessive video card had a DVI port..

I may have to go computer-parts-shopping this afternoon. I’m really unhappy about this – I really didn’t need this today. The question is, do I deal with blurry video that will hurt my eyes, or do I go buy a fix?

LJ feature request

Tuesday, August 22nd, 2006

I really think that LJ should allow Anonymous posters to include a psuedonym. Then I’d have some idea who to thank for finding those matching transformers for me…