Project Euler problem 4 T-SQL

Jun 07

Project Euler problem 4 was easier then 3. A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91*99 Find the largest palindrome made from the product of two 3-digit numbers. 1 2 3 4 5 6 7 8 9 10 11 12 13 USE tempdb WITH Scheherazade (i) AS ( SELECT TOP 600...

Read More

Project Euler problem 3 T-SQL Find Prime factors

Jun 06

Project Euler Problem 3 is: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? I thought of finding prime numbers and try to divide the number 600851475143 with them and then check if I found all the factors and finding the biggest one. For finding primes quickly under 10 millions Sieve of Eratosthenes is...

Read More

Sorting Chinese Characters in Javascript

May 27

To start learning to write a plug-in for jQuery component Datatables  I have made a webpage  http://sorting.lcube.se/. You can try to sort on different terms there. I plan to explain how Chinese characters are sorted and tell how I make the sorting and what troubles i get into. The first problem I had was that i thought  三 (san1) came after 二 (Er4). I was convinced...

Read More

Sortera kinesiska tecken i javascript

May 27

För att träna på att skriva plug-in till jQuery komponenten Datatables så har jag gjort en websida: http://sorting.lcube.se/ . Där kan man prova sortera på olika begrepp med min plug-in. Jag tänker förklara hur jag förstått hur kinesiska tecken sorteras samt utveckla hur jag gör  och vilka bekymmer som uppstår. Det första problemet jag hade var att jag trodde att 三...

Read More

Project Euler problem 2 T-SQL

May 26

Euler problem 2: By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. This is a sort of running sum problem that used to be hard (before T-SQL in SQL server 2012) I solved it with known math formula and recursion with common table expression. Tomas as usual solved with single-statement...

Read More