Skip to main content

Posts

Showing posts from April, 2014

Not so brilliant...

Try out the site https://brilliant.org . I have been solving problems here and my tally has reached 40 . I just reached level 3 (See pic) but could slide back to level 2 if i make a blunder forthwith. :-( Check it out anyways...

Not so brilliant...

Try out the site https://brilliant.org . I have been solving problems here and my tally has reached 40 . I just reached level 3 (See pic) but could slide back to level 2 if i make a blunder forthwith. :-( Check it out anyways...

Average this time

Average this time The rest of this text is the same as the median problem...See eariler post ar.Sort(); double ar_sum = 0; for (int h = 0; h < ar.Count; h++) { ar_sum += double.Parse(ar[h].ToString()); } double ar_average = 0; ar_average = Math.Round(ar_sum / ar.Count); MessageBox.Show(ar_average.ToString());

Average this time

Average this time The rest of this text is the same as the median problem...See eariler post ar.Sort(); double ar_sum = 0; for (int h = 0; h < ar.Count; h++) { ar_sum += double.Parse(ar[h].ToString()); } double ar_average = 0; ar_average = Math.Round(ar_sum / ar.Count); MessageBox.Show(ar_average.ToString());

Super Primes

//Super Primes are those primes whose index in the list of primes is the prime itself. (The first superprime is 3) //The challenge is to find the 142nd superprime. Here is my code in C#..Prime series generation function is not listed... ArrayList ar = new ArrayList(); List primes = GeneratePrimesNaive(1000); for (int j = 0; j < primes.Count; j++) { try { Application.DoEvents(); lblCounter.Text = (primes[primes[j] - 1]).ToString(); ar.Add(primes[primes[j] - 1]); } catch { } } MessageBox.Show(ar[141].ToString());

Super Primes

//Super Primes are those primes whose index in the list of primes is the prime itself. (The first superprime is 3) //The challenge is to find the 142nd superprime. Here is my code in C#..Prime series generation function is not listed... ArrayList ar = new ArrayList(); List primes = GeneratePrimesNaive(1000); for (int j = 0; j < primes.Count; j++) { try { Application.DoEvents(); lblCounter.Text = (primes[primes[j] - 1]).ToString(); ar.Add(primes[primes[j] - 1]); } catch { } } MessageBox.Show(ar[141].ToString());

How to find the median (data from excel file) in c#

Stumbled upon this problem to find the median ...Here is the solution ArrayList ar = new ArrayList(); string con = @"Provider=Microsoft.ACE.OLEDB.12.0;;Data Source=D:\temp\median.xlsx;Extended Properties='Excel 12.0;HDR=Yes;'"; using (OleDbConnection connection = new OleDbConnection(con)) { connection.Open(); OleDbCommand command = new OleDbCommand("select * from [Sheet1$]", connection); using (OleDbDataReader dr = command.ExecuteReader()) { while (dr.Read()) { ar.Add(int.Parse(dr[0].ToString())); } } } ar.Sort(); double ar_median = 0; double ar_low = 0; double ar_high = 0; int lo = 0; int hi = 0; int arlo = 0;

How to find the median (data from excel file) in c#

Stumbled upon this problem to find the median ...Here is the solution ArrayList ar = new ArrayList(); string con = @"Provider=Microsoft.ACE.OLEDB.12.0;;Data Source=D:\temp\median.xlsx;Extended Properties='Excel 12.0;HDR=Yes;'"; using (OleDbConnection connection = new OleDbConnection(con)) { connection.Open(); OleDbCommand command = new OleDbCommand("select * from [Sheet1$]", connection); using (OleDbDataReader dr = command.ExecuteReader()) { while (dr.Read()) { ar.Add(int.Parse(dr[0].ToString())); } } } ar.Sort(); double ar_median = 0; double ar_low = 0; double ar_high = 0; int lo = 0; int hi = 0;

Digital Sum

Digital Sum Digital Sum : The digital sum is the sum of the digits of a number taken iteratively till the result is less than 10. The problem statement is to get the number of integers less than 1 million where the digital sum is 1 and then, take the digital sum of this number which gives us the result. Note : Enable Javascript Here is the recursive function in C#. private void GetDigitalSum(double num, ref double num2) { //digital sum double sum = 0; for (int r = 0; r <= num.ToString().Length - 1; r++) { sum += double.Parse(num.ToString().Substring(r, 1)); } if (sum.Equals(1)) { num2 = -8; return; } else { if (sum > 9) { GetDigitalSum(sum, ref num2); } else

Digital Sum

Digital Sum Digital Sum : The digital sum is the sum of the digits of a number taken iteratively till the result is less than 10. The problem statement is to get the number of integers less than 1 million where the digital sum is 1 and then, take the digital sum of this number which gives us the result. Note : Enable Javascript Here is the recursive function in C#. private void GetDigitalSum(double num, ref double num2) { //digital sum double sum = 0; for (int r = 0; r <= num.ToString().Length - 1; r++) { sum += double.Parse(num.ToString().Substring(r, 1)); } if (sum.Equals(1)) { num2 = -8; return; } else { if (sum > 9) { GetDigitalSum(sum, ref num2); }

Near symmetric numbers

--> Near symmetric numbers Near symmetric numbers : Those numbers which when reversed and added to the original do not equal each other even after 25 iterations : Here is the recursive function.... private void GeneratePalindromeTotals(double num1, double num2, ref int nc, ref ArrayList ar) { ar = new ArrayList(); string rvnum1 = String.Empty; string rvnum2 = String.Empty; double rnum = 0; string snum2 = String.Empty; string snum1 = num1.ToString(); int lnum1 = snum1.Length; for (int u = lnum1 - 1; u >= 0; u--) { snum2 += snum1.Substring(u, 1); } num2 = double.Parse(snum2); rnum = num1 + num2; rvnum1 += rnum.ToString(); for (int rv = rnum.ToString().Length - 1; rv >= 0; rv--) { rvnum2 += rvnum1.ToString().Substring(rv, 1).To

Near symmetric numbers

--> Near symmetric numbers Near symmetric numbers : Those numbers which when reversed and added to the original do not equal each other even after 25 iterations : Here is the recursive function.... private void GeneratePalindromeTotals(double num1, double num2, ref int nc, ref ArrayList ar) { ar = new ArrayList(); string rvnum1 = String.Empty; string rvnum2 = String.Empty; double rnum = 0; string snum2 = String.Empty; string snum1 = num1.ToString(); int lnum1 = snum1.Length; for (int u = lnum1 - 1; u >= 0; u--) { snum2 += snum1.Substring(u, 1); } num2 = double.Parse(snum2); rnum = num1 + num2; rvnum1 += rnum.ToString(); for (int rv = rnum.ToString().Length - 1; rv >= 0; rv--) { rvnum2 += rvnum

Divine Science

APJ Abdul Kalam and Divine Science The world is looking for, and is finding, a new science; this must be Divine Science. The divine world is looking to give that science. These are spiritual, mystical, religious and theological truths of the contemporary world. The Divine Science would be a result of breakthroughs in understanding the fundamental basis of reality such as quantum theory, relativity theory, chaos theory, general systems theory, string theory, and others. The magnitude of infinite possibilities within the human body and external cosmos is amazing. The Divine Science has to transcend the certainty of strictly Newtonian clockwork notion to a new vision of a holistic and unified cosmos rooted in a non-local quantum reality that is fundamentally spiritual as opposed to material. It may also be described as intrinsically evolutionary and harmonious. -- APJ Abdul Kalam

Divine Science

APJ Abdul Kalam and Divine Science The world is looking for, and is finding, a new science; this must be Divine Science. The divine world is looking to give that science. These are spiritual, mystical, religious and theological truths of the contemporary world. The Divine Science would be a result of breakthroughs in understanding the fundamental basis of reality such as quantum theory, relativity theory, chaos theory, general systems theory, string theory, and others. The magnitude of infinite possibilities within the human body and external cosmos is amazing. The Divine Science has to transcend the certainty of strictly Newtonian clockwork notion to a new vision of a holistic and unified cosmos rooted in a non-local quantum reality that is fundamentally spiritual as opposed to material. It may also be described as intrinsically evolutionary and harmonious. -- APJ Abdul Kalam

Decypher the letters and find the hidden message....

I found this problem where each letter is encoded as per the pattern described in the solution and the idea is to find the hidden message....Click the button to find the solution...And make sure that javascript is enabled on your browser... ArrayList ar = new ArrayList(); Hashtable ht = new Hashtable(); ht.Add("ka","A"); ht.Add("zu", "B"); ht.Add("mi", "C"); ht.Add("te", "D"); ht.Add("ku", "E"); ht.Add("lu", "F"); ht.Add("ji", "G"); ht.Add("ri", "H"); ht.Add("ki", "I"); ht.Add("zu2", "J"); ht.Add("me", "K"); ht.Add("ta", "L"); ht.Add("rin", "M");

Decypher the letters and find the hidden message....

I found this problem where each letter is encoded as per the pattern described in the solution and the idea is to find the hidden message....Click the button to find the solution...And make sure that javascript is enabled on your browser... ArrayList ar = new ArrayList(); Hashtable ht = new Hashtable(); ht.Add("ka","A"); ht.Add("zu", "B"); ht.Add("mi", "C"); ht.Add("te", "D"); ht.Add("ku", "E"); ht.Add("lu", "F"); ht.Add("ji", "G"); ht.Add("ri", "H"); ht.Add("ki", "I"); ht.Add("zu2", "J"); ht.Add("me", "K"); ht.Add("ta", "L"); ht.Add("rin", "M&

Amicable numbers OR Amicable Solution?

Amicable Numbers Find the amicable numbers - i.e. sum of factors of the first number (except itself) equals the second AND vice versa....(210,284),(1184,1210) etc. Solution below in C# //Subroutine private void GetFactorDetails(double num, ref double numsum) { //Positively Described Numbers - Part 1 double n = num; double j = 2; double k = 0; double fcount = 1; ArrayList ar = new ArrayList(); while (j < n) { k = (n % j); if (n != j) { if ((int)k == 0) { fcount += j; j++; numsum = fcount; continue; } else { j++; continue; } } n++; fcount = 0;

Amicable numbers OR Amicable Solution?

Amicable Numbers Find the amicable numbers - i.e. sum of factors of the first number (except itself) equals the second AND vice versa....(210,284),(1184,1210) etc. Solution below in C# //Subroutine private void GetFactorDetails(double num, ref double numsum) { //Positively Described Numbers - Part 1 double n = num; double j = 2; double k = 0; double fcount = 1; ArrayList ar = new ArrayList(); while (j < n) { k = (n % j); if (n != j) { if ((int)k == 0) { fcount += j; j++; numsum = fcount; continue; } else { j++; continue; } } n++;

What's wrong with my order schedule?

A novice in programming came up with this code... int num1 = 10; int num2 = 50; while (num1 < num2) { placeorders(); } What is the effect on the orders? Too many / too few / pretty much the same? Can you warrant a guess?.. Move the mouse over the text to see the answer... Guess the result...

What's wrong with my order schedule?

A novice in programming came up with this code... int num1 = 10; int num2 = 50; while (num1 < num2) { placeorders(); } What is the effect on the orders? Too many / too few / pretty much the same? Can you warrant a guess?.. Move the mouse over the text to see the answer... Guess the result...

Quotable Quote - Yuri Gagarin

Treasure this marvel : When I orbited the Earth in a spaceship, I saw for the first time how beautiful our planet is. Mankind, let us preserve and increase this beauty, and not destroy it.

Quotable Quote - Yuri Gagarin

Treasure this marvel : When I orbited the Earth in a spaceship, I saw for the first time how beautiful our planet is. Mankind, let us preserve and increase this beauty, and not destroy it.

Science debates : Can we have zones of backward time?

Is it possible theoretically to have zones of backward time in the universe? This would still obey the laws of cause and effect where a more complex state would resolve into a simpler one. eg. On such a planet a human would be born old and die young. Cause and effect would still apply although defying commonly accepted norms and conventions. Entropy would still increase (where the state of more complexity would be the initial state and the simple state - a paradox). A state change would contribute to the increase in entropy and people would still be eccentric. Is such a scenario possible in realty? As far as i know there is nothing in science that a priori renders this impossible? -->

Science debates : Can we have zones of backward time?

Is it possible theoretically to have zones of backward time in the universe? This would still obey the laws of cause and effect where a more complex state would resolve into a simpler one. eg. On such a planet a human would be born old and die young. Cause and effect would still apply although defying commonly accepted norms and conventions. Entropy would still increase (where the state of more complexity would be the initial state and the simple state - a paradox). A state change would contribute to the increase in entropy and people would still be eccentric. Is such a scenario possible in realty? As far as i know there is nothing in science that a priori renders this impossible? -->