Login or Sign Up to become a member!
LessThanDot Site Logo

LessThanDot

A Technical Community for IT Professionals

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Highly Rated Users

Forum
No Posts Rated

Top 50
Given
Received

Forum Statistics

Users
Members:
1875
Members Online:
3
Guests Online:
80

Total Post History
Posts:
81446
Topics:
18714

7-Day Post History
New Posts:
0
New Topics:
0
Active Topics:
0

Our newest member
konam534As

Other

FAQ
All times are UTC [ DST ]

Google Ads

transformation is puzzle

Mind Boggling Puzzles, to keep that grey matter in shape...
Forum rules
Always post answers in a "Hidecode" tag, so that others have a chance to answer the question too.
Please wait...

transformation is puzzle

Postby ramireddyindia on Tue Jul 13, 2010 7:35 am

Just now saw a puzzle in stackoverflow.com

>4 Is Magic

15 is 7
7 is 5
5 is 4

4 Is Magic.

25 is 10
10 is 3
3 is 5
5 is 4

4 is Magic


Any number can be transformed as 4. Transformation process is below.
Suppose, 25 in english is "Twenty five". It has 10 letters.
so, 25 is 10.

Next 10 in english "Ten" , so 10 is 3.
Next 3 in english "Three", so 3 is 5.
Next 5 in english "Five", s0 5 is 4.

Now 4 can be written as 4 only, since it has 4 letters and it will stop at 4.


Now can any one write a codeblock ,which will take any number below 20 and show the transformation process to 4.
ramireddyindia
Sage
Sage
LTD Bronze - Rating: 146LTD Bronze - Rating: 146LTD Bronze - Rating: 146
 
Posts: 267
Joined: Tue Jul 14, 2009 1:45 pm
Unrated

Re: transformation is puzzle

Postby Thirster42 on Tue Jul 13, 2010 2:59 pm

:-D

Code is hidden, SHOW
Ask three DBAs a question, and you’ll get four different answers.

-Brent Ozar
User avatar
Thirster42
Guru
Guru
LTD Silver - Rating: 517LTD Silver - Rating: 517LTD Silver - Rating: 517LTD Silver - Rating: 517LTD Silver - Rating: 517
LTD Silver - Rating: 517LTD Silver - Rating: 517LTD Silver - Rating: 517
 
Posts: 4646
Joined: Tue Nov 11, 2008 5:49 pm
Location: Jefferson City, Mo

Re: transformation is puzzle

Postby Thirster42 on Wed Jul 21, 2010 2:17 pm

is there really noone else that's going to reply to this?
Ask three DBAs a question, and you’ll get four different answers.

-Brent Ozar
User avatar
Thirster42
Guru
Guru
LTD Silver - Rating: 517LTD Silver - Rating: 517LTD Silver - Rating: 517LTD Silver - Rating: 517LTD Silver - Rating: 517
LTD Silver - Rating: 517LTD Silver - Rating: 517LTD Silver - Rating: 517
 
Posts: 4646
Joined: Tue Nov 11, 2008 5:49 pm
Location: Jefferson City, Mo
Unrated

Re: transformation is puzzle

Postby ThatRickGuy on Sat Oct 02, 2010 4:21 am

VB.Net, not written in an IDE, nor compiled, and I'm sleepy, so I've probably made a mess of it... but in theory, it should work.
Code is hidden, SHOW


-Rick
O_o \__o- \__o- \__o- \__o-
User avatar
ThatRickGuy
LTD Admin
LTD Admin
LTD Silver - Rating: 311LTD Silver - Rating: 311LTD Silver - Rating: 311LTD Silver - Rating: 311LTD Silver - Rating: 311
LTD Silver - Rating: 311
 
Posts: 1598
Joined: Thu Oct 11, 2007 3:21 pm
Location: Madison, WI
Unrated

Re: transformation is puzzle

Postby tarwn on Sun Oct 03, 2010 1:47 pm

With added magic and scalability (goes up to 999,999,999,999 and can raise limit by adding to top of set):

Code is hidden, SHOW


Output is:
one hundred twenty three thousand, four hundred fifty six
nine hundred ninety nine billion, nine hundred ninety nine million, nine hundred ninety nine thousand, nine hundred ninety nine
negative nine hundred ninety nine billion, nine hundred ninety nine million, nine hundred ninety nine thousand, nine hundred ninety nine
zero

123456: 48 chars
48: 10 chars
10: 3 chars
3: 5 chars
5: 4 chars

999999999999: 106 chars
106: 13 chars
13: 8 chars
8: 5 chars
5: 4 chars

-999999999999: 114 chars
114: 18 chars
18: 8 chars
8: 5 chars
5: 4 chars

0: 4 chars


Edit: Corrected a bug, added zero and negatives

Um, yeah...I'm going to need you to come in on Saturday -- Bill Lumbergh, Office Space
User avatar
tarwn
LTD Admin
LTD Admin
LTD Gold - Rating: 897LTD Gold - Rating: 897LTD Gold - Rating: 897LTD Gold - Rating: 897LTD Gold - Rating: 897
LTD Gold - Rating: 897LTD Gold - Rating: 897LTD Gold - Rating: 897LTD Gold - Rating: 897LTD Gold - Rating: 897
LTD Gold - Rating: 897
 
Posts: 3838
Joined: Fri Oct 12, 2007 11:10 am
Location: Raleigh, NC, USA
Unrated