/ home / blog
brain activity log

12.03.2007 - Monday - 03:57 - Star Wars
 

Anakin Skywalker, now Darth Vader:

 

Where is Padmé ?

Is she safe ?

Is she all right ?

 

Lord Darth Sidious:

 

It seems.. in your anger... you killed her

 



05.03.2007 - Monday - 13:08 - Rhinovirus

I got cold ://// Damn rhinovirus. Well..it's the most common illness in the world and I haven't got it for a year now so nothing special: I'll be outta home in a couple of days. I'll take it constructively and try to study & work anyway.

I've just discovered that I've been using the terms influenza and cold interchangeably. In fact these are two distinct ilnesses with common symptoms, both caused by viral infection. Influenza is caused by the very specific family of Orthomyxoviridae RNA viruses while the common cold is caused by several families of other viruses affecting the respiratory system (mainly rhinoviruses, coronaviruses, and also certain echoviruses, paramyxoviruses, and coxsackieviruses).

In humans, influenza's effects are much more severe than those of the common cold, and last longer. Common cold is deadly in one case over 50.000 while influenza has been a pandemic killer in the past and can be still deadly for the weak, old or chronically ill. Mine is almost surely common cold because I have no fever.

I had to void the appointment at Sistemi ITC. Shifted to friday. Romina obviously thought that the illness was an excuse :D It couldn't be: I wouldn't miss a meeting with such a nice girl unless there was a real reason :P ... especially in such a sunny day.

Back to work (sugar reef).



25.02.2007 - Sunday - 22:21 - Diary

There are ongoing massive changes in the continuum :)

TVS service is moving offices from the peaceful EBS establishment to the primary Bassilichi dept. People aren't happy about it. Well, the bright side is that innovation might bring positive results. We'll see.

Upgraded gentoo on etherea. It took me several days and caused some headcaches. I had to fight with random segfaults caused by a faulty DRAM bank and completly messed dependancies. At a certain point something something got totally b0rken and I've ended up with a system unable to compile and run 32 bit apps. Bleah :D Well... I've fixed it and I'll be probably switching to gcc 4.1.1 too, in the next days.

Linux etherea 2.6.19-gentoo-r5 #3 Sat Feb 24 17:02:52 CET 2007
x86_64 AMD Athlon(tm) 64 Processor 3500+ AuthenticAMD GNU/Linux

Almost finished porting kvirc to Qt 4: only few modules are missing now. Got it to a point where others can take care of separate modules: Noldor is taking care of the objects.

Bought a new shiny Sapphire Radeon X1950 Pro. Too bad it doesn't boot with my Abit MoBo :( In fact it gets through BIOS, it does POST but it locks up nearly in the end, probably when attempting real boot by invoking INT 19h. It *might* be a problem related to the power supply not being able to source enough current. Tomorrow I'll buy a 500W or greater unit and will try. If it doesn't work then I'll try to upgrade the BIOS.

Studied a massive number of metal songs recently. It's very fun to play them. The most recent entries are "Tornado Of Souls" by Megadeth and "Antisocial" by Anthrax. Actually I'm taking on "Anna Molly" by Incubus and "Can I Play With Madness" by Iron Maiden.

Spam is reaching absurd levels. Spamassassin behaves quite well but since once in a while it blows out a false positive I'm substantially forced to dig in the trashcan looking for reasonable subjects or known senders. Hate it. This blog gets spammed too: it looks like I can't filter them out all. I need to add some anti-spam measure like the "type the digits you see" image...

Released GEOS 2.0.0. It works like a charm :)

Started the fourth eTraveler milestone: will mainly take care of path updates and implement a new XML data format. Will also try to doom some of the remaining TomTom Navigator problems...

Eva is moving to London... or somewhere nearby. She will be working for RedHat: a great chance! Good Luck Eve!!! :*

There are rumours about CNR.



14.02.2007 - Wendesday - 23:30 - PragMathic Valentines

This 3d surface is supposed to be a Valentines heart.

In fact it's a 30400 polygon phong shaded RGB=255,0,0 numeric approximation of

illuminated by a spot light placed at (-1.0,-1.0,0.8).

I had a couple of hard hours while trying to plot (and later render) the implicit equation with matlab but in the end it looks rather nice, eh ?



02.01.2007 - Tuesday - 02:55 - Primality Tests

Happy New Year to everyone :)

At a certain point, in the middle of the New Year party we ended up talking about prime numbers. The simple question was if 2007 was prime or not. A guy immediately comed out with the answer: no, it's divisible by 3. He used a simple "rule of thumb": if the digits of a number sum up to something that is divisible by 3 then the original number is also divisible by 3. And in fact 2+0+0+7 yelds 9 that is obviously 3*3.

So 2007 is not a prime year. But how is it that the rule of thumb works ? We were quite convinced that the rule is correct by carrying out a ton of working examples but (probably because of alcohol :D) were unable to prove it.

In fact a pedantic proof is not as trivial as one might expect for such a simple rule. Anyway, a bit of thinking (with a sane mind) pulled it out. Here it is.

Theorem

Given an integer x let y be the sum of its decimal digits. If y is divisible by 3 then x is also divisible by 3 and vice-versa.

Since for x=0 the theorem is trivially true, let x be a non-zero integer and consider it's positional rappresentation:

The digits di in the sum are obviously the positional digits of x ordered by magnitude (power of ten). Let y be the sum of the digits of x.

Asserting that "if y is divisible by 3 then x is also divisible by 3 and vice-versa" is equivalent to asserting that "if there exists an integer w that yelds x=3w then there must exist an integer v that yelds y=3v and vice-versa".

A yet more convenient way to formally state the theorem thesis is: given

prove that "if w lies in Z then also v lies in Z and vice-versa".

To prove this let's concentrate on the positional rappresentation of our number.

We can trivially rewrite it as

which can be decomposed in

which clearly shows that the second component is the sum of the digits defined above and allows us to write

and then rewrite it further as

Now if we assume that w is an integer then v is an integer (lies in Z) if and only if

The same condition remains if we first assume v to be an integer and ask for w being an integer: it still leads us to prove that

Now if you're cool, you should have already be "seeing" the end of this proof since the formula above can be "trusted" to be true if you realize that 10^i - 1 leads always to a number with digits formed by a sequence of all 9.... but let's be pedantic and prove this formally.

To do this we need to take a quick look at a nice property of the foolowing geometric serie:

We can multiply both sides by (a-1) to obtain

Expliciting the multiplication

and removing the cancelling terms we get

which is quite interesting since by plugging in a=10 it allows us to write that

and for i=k+1 -> k=i-1 it allows to rewrite our clue formula as

and then by trivial algebric manipulation

Remember that in the formulas above we have assumed x != 0 (since, as stated at the beginning, for x=0 the theorem is trivially true). This in turn requires i > 0 and thus i-1 is at least 0.

Finally since , since 10^j is an integer and a sum of integers is still an integer it's obvious that

which proves our theorem.

Cool eh? What a strange world... :)

It is interesting to state that this thingie can be applied recursively. If y is too big to be trivially known to be divisible by 3 then the sum of its digits can be taken and the theorem can be applied again.

Another note is that the theorem will work for bases B that can be written in the form B=3N+1 where N is an integer. It will work for base 4, 7, 10, 13, 16... but not for base 2 (for example). This can be proven by substituting (3N+1) in the whole theorem in place of 10 and noticing that it will lead us to prove that

The geometric serie property is still valid and yelds

which is rewritten as

This allows us to rewrite our question as

which, since di and N are integers, yelds the obvious conclusion that

Marvellous...

One can push this thingie even further and assert that to verify the divisibility by a number D one has to write the number x in a base B that can be written as B=(DN+1), where N is an integer greater than zero, sum up the digits of B and verify if the obtained number is divisible by D.

This can be proven by reusing the last version of the theorem and plugging D instead of 3. The question will now be

And it will lead us to state that

Which is indeed true since D, N and di are integers.

Interesting. So if you want to know if 3147975 is divisible by 255 all you could write 3147975 in a base of the form 255N+1, for example 256 (huh.. we're talking of BYTES!), sum up the digits and check if it's divisible by 255, recursively.

3147975 is (48)(8)(199) in base 256 which magically sums up to 255.... doh!

I could have written this thingie in base 255*2+1=511, which would yeld a rappresentation of (12)(28)(215) which again sums up to 255.

Unbelieveable...

The bad news, eventually, is that this theorem can't be easily used as a general primality test since it involves base changes. A generic change from base A to base B requires consecutive divisions of the original number... so one can actually directly divide the number by the divisor and check if there is a remainder... This can be used as primality test for some divisors, in particular the ones that lead to the bases B to which switching is easy. Switching from base 10 to base 100 is straightfoward and does not require any division to be performed. Same goes for base 2 and base 16, for example.

Now I have to work. Further investigations later.

Have a nice day!



want more ?

... really ? :D

Browse around then.

You're viewing 5 posts per page: you can view more or less, if you want.

The entries marked in red are the ones you're viewing now.

2007.09.18-06.07
2007.09.09-04.27
2007.08.26-02.23
2007.08.21-02.02
2007.08.12-20.15
2007.07.22-11.30
2007.07.21-10.00
2007.07.11-17.20
2007.06.10-02.57
2007.06.02-03.33
2007.05.30-20.07
2007.05.21-11.35
2007.04.14-21.53
2007.03.26-02.22
2007.03.23-10.12
2007.03.20-18.10
2007.03.16-01.10
2007.03.12-21.43
2007.03.12-03.57
2007.03.05-13.08
2007.02.25-22.21
2007.02.14-23.30
2007.01.02-02.55
2006.12.17-17.01
2006.11.26-20.26
2006.11.22-03.14
2006.11.21-01.30
2006.11.04-05.09
2006.09.16-04.18
2006.08.18-03.45
2006.08.14-17.58
2006.08.14-03.08
2006.08.02-20.38
2006.07.25-04.10
2006.07.25-03.14
2006.06.23-18.12
2006.06.02-13.25
2006.05.18-16.27
2006.05.18-14.30
2006.05.17-19.30
2006.04.29-19.30
2006.04.26-01.48
2006.04.22-13.06
2006.04.16-12.26
2006.04.11-03.10
2006.04.10-04.32
2006.04.08-14.59
2006.04.07-14.54
2006.04.06-09.00
2006.04.05-23.10
2006.04.05-11.00
2006.04.04
2006.04.03
2006.04.02
2006.04.01
2006.03.31
2006.03.27
2006.03.26
2006.03.25
2006.03.24
2006.03.23
2006.03.22
2006.03.20
2006.03.19
2006.03.17
2006.03.14
2006.03.07
2006.03.05
2006.02.23
2006.02.19
2006.02.13
2006.01.10
2005.12.29
2005.09.24
2005.09.21
2005.08.21
2005.08.18
2005.07.31
2005.07.04
2005.06.13
2005.04.10
2005.04.05
2004.12.18
2004.12.17
2004.12.16
2004.12.15
2004.12.14
2004.12.13
2004.12.12
2004.12.11
2004.12.10
2004.12.09
2001.06.02