ROTFL! There are some really kickass comics from KDE forums:

http://forum.kde.org/best-unix-linux-distro-related-jokes-t-19993.html

Enjoy :D

### [SOLUTION] Google Treasure Hunt - Primes

Here comes the II. quest from Google Treasure Hunt. Maybe it sounds very simple, and algorithm what we've (Szakál Károly (ftnkaresz /at gmail /dot com) and I) used isn't so difficult, but after 3 hours of hard-coding, what we got? A full stack error with 2GB RAM. ;)

Find the smallest number that can be expressed as

the sum of 3 consecutive prime numbers,

the sum of 9 consecutive prime numbers,

the sum of 253 consecutive prime numbers,

the sum of 781 consecutive prime numbers,

and is itself a prime number.

For example, 41 is the smallest prime number that can be expressed as

the sum of 3 consecutive primes (11 + 13 + 17 = 41) and

the sum of 6 consecutive primes (2 + 3 + 5 + 7 + 11 + 13 = 41).

Recursion is very bad thing in programming. It isn't requires deeper analysis of problems, there is enough to make good type definitions, a good algorithm with some recursive calls and return statement and finally there recursion will solve the problem for you. Okay! :)

The main goal of Data Structure and Algorithms is how to solve problems without recursive calls, and how to avoid the whole recursion.

The first solution made without recursion in programming language C. The main part of this program is an infinite while loop, what terminates itself if the right prime sum found:

Finally, our number is: 6304483.

The full sorce code:

Find the smallest number that can be expressed as

the sum of 3 consecutive prime numbers,

the sum of 9 consecutive prime numbers,

the sum of 253 consecutive prime numbers,

the sum of 781 consecutive prime numbers,

and is itself a prime number.

For example, 41 is the smallest prime number that can be expressed as

the sum of 3 consecutive primes (11 + 13 + 17 = 41) and

the sum of 6 consecutive primes (2 + 3 + 5 + 7 + 11 + 13 = 41).

Recursion is very bad thing in programming. It isn't requires deeper analysis of problems, there is enough to make good type definitions, a good algorithm with some recursive calls and return statement and finally there recursion will solve the problem for you. Okay! :)

The main goal of Data Structure and Algorithms is how to solve problems without recursive calls, and how to avoid the whole recursion.

The first solution made without recursion in programming language C. The main part of this program is an infinite while loop, what terminates itself if the right prime sum found:

while(1) {

switch (r) {

case 0: result=PrimSum(previousPrime,1063,&previousPrime);

ix=0;

nextPrime=2;

r=sum(nextPrime,1063,result);

break;

case 1: ix++;

if (!(ix<5)) { return 0; }

nextPrime=2;

r=sum(nextPrime,array[ix],result);

break;

case 2: r=sum(nextPrime=NextPrim(nextPrime),array[ix],result);

break;

}

}

Finally, our number is: 6304483.

The full sorce code:

#include

#include

#include

//4355977//d9062d

const int array[]={1063,309,183,137,5};

int ix=0;

int nPrimSum(int,int);

int PrimSum(int,int,int*);

int isPrime(int);

int sum(int,int,int);

int NextPrim(int);

int main()

{int result, r=0;

int previousPrime=2, nextPrime=2;

while(1) {

switch (r) {

case 0: result=PrimSum(previousPrime,1063,&previousPrime);

ix=0;

nextPrime=2;

r=sum(nextPrime,1063,result);

break;

case 1: ix++;

if (!(ix < 5)) { return 0; }

nextPrime=2;

r=sum(nextPrime,array[ix],result);

break;

case 2: r=sum(nextPrime=NextPrim(nextPrime),array[ix],result);

break;

} //switch

} //while

return 0;

}

int isPrime(int xx) {

double i;

double a=sqrt(xx);

for(i=2; i<=a; i++) {

if (!(xx%((int)i))) return 0;

}

return 1;

}

int NextPrim(int pr) {

int i;

for(i=pr+1; !(isPrime(i)); i++);

return i;

}

int PrimSum(int min, int step, int *ePrim) {

int i,ret;

for(i=min; !(isPrime(ret=nPrimSum(i,step))); i=NextPrim(i))

;

*ePrim=NextPrim(i);

return ret;

}

int nPrimSum(int min, int step) {

int i=0;

int numb=min, summ=0;

while (i < step) {

if (isPrime(numb)) {

summ+=numb;

i++;

}

numb++;

}

return summ;

}

//----------------------------------------------------

int sum(int min, int step, int sum_n) {

int i=0;

int numb=min, summ=0;

while (i < step) {

if (isPrime(numb)) {

summ+=numb;

i++;

}

numb++;

}

if (summ==sum_n) return 1;

if (summif (summ>sum_n) { return 0; }

}

### Hacking Google Image Search

I've just found and interesting thread on http://forums.opensuse.org/ about Google's image search. :)

So, to get started go to Google's site, and click to image search. Search for something popular (flowers, cars). When the pictures are displayed paste this code into your browsers address bar:

javascript:R= 0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI= document.images ; DIL=DI.length; function A(){for(i=0; i < DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math. sin(R*x1+ i*x2+x3)* x4+x5; DIS.top=Math. cos(R*y1+ i*y2+y3)* y4+y5}R++ }setInterval('A()',5); void(0)

Enjoy! :)

So, to get started go to Google's site, and click to image search. Search for something popular (flowers, cars). When the pictures are displayed paste this code into your browsers address bar:

javascript:R= 0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI= document.images ; DIL=DI.length; function A(){for(i=0; i < DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math. sin(R*x1+ i*x2+x3)* x4+x5; DIS.top=Math. cos(R*y1+ i*y2+y3)* y4+y5}R++ }setInterval('A()',5); void(0)

Enjoy! :)

### [SOLUTION] Google Treasure Hunt - Robot

Okay! Let's solve this programming problem without writing a single line of code. :)

A robot is located at the top-left corner of a 60 x 31 grid:

The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid.

Our robot can 30 times to step down and 59 times to step right, because it is staying on the first block (1, 1).

We can write down his way from location (1, 1) to location (60, 31) like this:

R - right, D - down.

RDRDDDRDDRDDRD......RDRRRDDDRDRD.

The only question is: how many different (unique) arrays we have from 59 R and 30 D?

Fill out a row with 59 R:

RRRRRRRRR........RRRRRRRRRRRR......RRRRRRRRRR and take 30 D to random places without repeating an already existing array. On more mathematical language, number of unique arrays (unique permutations) with length 59+30 from 30 D is exactly:

Comments are welcome! ;)

A robot is located at the top-left corner of a 60 x 31 grid:

The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid.

Our robot can 30 times to step down and 59 times to step right, because it is staying on the first block (1, 1).

We can write down his way from location (1, 1) to location (60, 31) like this:

R - right, D - down.

RDRDDDRDDRDDRD......RDRRRDDDRDRD.

The only question is: how many different (unique) arrays we have from 59 R and 30 D?

Fill out a row with 59 R:

RRRRRRRRR........RRRRRRRRRRRR......RRRRRRRRRR and take 30 D to random places without repeating an already existing array. On more mathematical language, number of unique arrays (unique permutations) with length 59+30 from 30 D is exactly:

Comments are welcome! ;)

### Gimp 3.0 RC

More Photoshopis for Photoshopers. But it's still Gimp. :)

There was a little discussion about Gimp, and his user-unfriendly attributes. Here i found this picture about 3.0 Release Candidate. The UI looks better... IMHO it is more professional. What do you think?

### Google Treasure Hunt

Hi again here! First, sorry I have a couple of TODOs in the past few weeks around the university, tests, exams, etc. I have a lot of new things in my mind what I want to share with you. :) Are you heard about Google Treasure Hunt? An interesting programming challenge. The problems are not so easy, you need to find out a lot of things, not just the algorithms. We have two problems solved, I'll post here the solutions in the next few days. Maybe you can use it to something, or start your own Treasure Hunt account with two already solved problems. :)

Okay, let's get started. Here is the first question (maybe the shortest).

"A robot is located at the top-left corner of a 60 x 31 grid. The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid.

How many possible unique paths are there?

(Note: Answer must be an exact, decimal representation of the number.)"

ps.: If you have some mathematical background and one calculator then without writing a single line of code you can solve this problem in 5 minutes.

Good luck. Good Hunting. :)

Okay, let's get started. Here is the first question (maybe the shortest).

"A robot is located at the top-left corner of a 60 x 31 grid. The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid.

How many possible unique paths are there?

(Note: Answer must be an exact, decimal representation of the number.)"

ps.: If you have some mathematical background and one calculator then without writing a single line of code you can solve this problem in 5 minutes.

Good luck. Good Hunting. :)