September 16, 2014 at 7:13 am
Sean Pearce (9/16/2014)
And this relates to SQL Server how? I am not here for maths lessons.
It isn't even really math. From the wiki page.
These are odd facts, very suitable for puzzle columns and likely to amuse amateurs, but there is nothing in them which appeals to the mathematician.
I too found it strange to have to research what the name of this was. Still I thought was an interesting question.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 16, 2014 at 7:13 am
Koen Verbeeck (9/16/2014)
Is that ... a recursive query to generate numbers? :sick:
I noticed that too. :w00t:
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 16, 2014 at 7:45 am
I feel so illuminated now.
Aigle de Guerre!
September 16, 2014 at 7:49 am
SqlMel (9/16/2014)
Hany Helmy (9/16/2014)
Sean Pearce (9/16/2014)
And this relates to SQL Server how? I am not here for maths lessons.+ 1
+ select floor(log(square(POWER(substring (cast (1000 as varchar(10)),1,1),5000))*3))
ctrl+c
ctrl+v
(sql is so beautiful)
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
September 16, 2014 at 7:54 am
Koen Verbeeck (9/16/2014)
Is that ... a recursive query to generate numbers? :sick:😀
Technically, the numbers are rational numbers as well.
Anyway, nice question.
Yeah, and the leading statement terminator and the red herring in the Rational numbers.
:hehe:
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
September 16, 2014 at 8:13 am
Good brain teaser, Shiva, thanks. While you most likely wouldn't see this in "real life" queries, it requires knowledge of recursive CTEs and MAXRECURSION (i.e. "does 0 mean no recursion allowed or no limit to recursion?"), and it tests your ability to read very complex expressions and understand what they are trying to do.
When I first read this question in the newsletter e-mail (without the list of options), I thought it meant what data type will be returned, because of all of the folding, spindling, and mutilating of the numbers, so I was ready to select "integers".:-) However, when I saw the list of choices, I knew it wasn't just a sequence of rational numbers, and it wasn't prime numbers, so I had to check the Wikipedia definitions of the other terms.
Actually, this code isn't quite correct, because it is only looking for three digit Armstrong numbers, while ignoring other powers. For example, the numbers 0-9 are all Armstrong numbers, because 0^1=0, 1^1=1, 2^1=2, 3^1=3, etc. The code should actually compute the length of the numbers and use that for the exponent.
For those who are curious (all three of you:-D), here is the list for four digits (which requires changing the power to 4 and adding another term to extract the fourth digit, and excluding numbers less than 1000):
1634, 8208, 9474
And for five digits (excluding numbers less than 10000):
54748, 92727, 93084
September 16, 2014 at 9:08 am
My mathematics minor finally gets some use 😛
September 16, 2014 at 9:11 am
Interesting question.
September 16, 2014 at 9:51 am
yes you are 100% right., but here one of my friend got this question in his MNC interview.like: write the logic to get Armstrong numbers?
Thanks,
Shiva N
Database Consultant
September 16, 2014 at 9:56 am
Shiva N (9/16/2014)
yes you are 100%, but here one of my friend got this question in his MNC interview.like: write the logic to get Armstrong numbers?
WOW!!! I would have not done well on that question since I had no idea what Armstrong numbers were until today. 😀
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 16, 2014 at 10:02 am
Thank you so much dear, now i got complete information from you, thanks allot.
Thanks,
Shiva N
Database Consultant
September 16, 2014 at 10:26 am
Shiva N (9/16/2014)
Thank you so much dear, now i got complete information from you, thanks allot.
Shiva, in what spirit was this comment made? I must not understand for it appears to be critical and be belittling. Could you help me understand.
Thank you.
Not all gray hairs are Dinosaurs!
September 16, 2014 at 10:44 am
its related to Armstrong numbers.
Thanks,
Shiva N
Database Consultant
September 16, 2014 at 11:29 am
Shiva N (9/16/2014)
Thank you so much dear, now i got complete information from you, thanks allot.
If you are referring to my post it was in reference to your comment about a friend who had this question during an interview. Not really sure what you are trying to say here but if I somehow offended you it must be because you interpreted my comment in some way other than the way it was intended.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 16, 2014 at 11:36 am
Shiva N (9/16/2014)
yes you are 100%, but here one of my friend got this question in his MNC interview.like: write the logic to get Armstrong numbers?
Seems a bit zealous to ask about a concept that is more for math puzzles than actual math. I surely would have missed the question because I would want to know why they need to associate Louis Armstrong, Lance Armstrong, or Neil Armstrong to some number sequence outside of the musical notes, number of Tour de France victories, or countdown sequence (respectively).
Surely they would have had to explain what they meant by such a thing if they should get an adequate comparison of candidates to measure true tsql skill and problem solving ability.
😎
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 15 posts - 16 through 30 (of 46 total)
You must be logged in to reply to this topic. Login to reply