Author |
Topic |
spirit1
Cybernetic Yak Master
11752 Posts |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2006-03-15 : 07:35:02
|
I reeeeally wish you wouldn't post stuff like this! Argh! <comic expression of angst>Would someone post the answers to the toughies? |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-15 : 07:41:45
|
outside of the box ones?for those i only have the last one to get...Go with the flow & have fun! Else fight the flow |
 |
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2006-03-15 : 08:05:23
|
quote: Originally posted by SamCWould someone post the answers to the toughies?
Why? They're all in OEIS. Not that the "outside the box" ones have anything to do with Maths. |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-15 : 08:10:49
|
what's OEIS?? <EDIT>Arnold no fair... now you've spoiled the funOEIS = The On-Line Encyclopedia of Integer Sequences</EDIT>well they do last one is giving me trouble.also can't figure out 59, 154, 605, 1111,Go with the flow & have fun! Else fight the flow |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-15 : 08:19:39
|
ran the last one in OEIS... i mean come on... who outside of US could've known that....Go with the flow & have fun! Else fight the flow |
 |
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2006-03-15 : 08:28:53
|
quote: Originally posted by spirit1 ran the last one in OEIS... i mean come on... who outside of US could've known that....
I agree, it's just not cricket. (No, that would be something like 18, 1, 79, 112, 40, 58, 123) |
 |
|
jhermiz
3564 Posts |
Posted - 2006-03-15 : 09:45:19
|
Sometimes you totally got to think outside of the box for some of this stuff. I got up to "Math Comes In" and was royally stumped.:( Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url] |
 |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2006-03-15 : 10:02:15
|
Mladen, you were wise not to include me in the list of people who would enjoy that. <shudder> btw, did you math geeks celebrate pi day yesterday? (March 14)Be One with the OptimizerTG |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-15 : 10:07:25
|
i might have if the subject would allow more chars yeah we ate a lot of pies Go with the flow & have fun! Else fight the flow |
 |
|
Wanderer
Master Smack Fu Yak Hacker
1168 Posts |
Posted - 2006-03-15 : 10:22:03
|
quote: Originally posted by spirit1 what's OEIS?? <EDIT>Arnold no fair... now you've spoiled the funOEIS = The On-Line Encyclopedia of Integer Sequences</EDIT>well they do last one is giving me trouble.also can't figure out 59, 154, 605, 1111,Go with the flow & have fun! Else fight the flow 
59 (+95 reverse) =154 (+451) =605 (+ 506) =1111 (+1111)=2222*##* *##* *##* *##* Chaos, Disorder and Panic ... my work is done here! |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-15 : 10:36:48
|
got it already... thanx thoughGo with the flow & have fun! Else fight the flow |
 |
|
Wanderer
Master Smack Fu Yak Hacker
1168 Posts |
Posted - 2006-03-15 : 10:39:35
|
np...*##* *##* *##* *##* Chaos, Disorder and Panic ... my work is done here! |
 |
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2006-03-15 : 10:47:27
|
quote: 59 (+95) = 154 (+451) = 605 (+ 506) = 1111
But does it ever reach a palindromic number if you start with 196? |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-15 : 11:14:31
|
i'd go with no.Go with the flow & have fun! Else fight the flow |
 |
|
Wanderer
Master Smack Fu Yak Hacker
1168 Posts |
Posted - 2006-03-15 : 11:24:46
|
Un less I've got a logic error, not in the first 81 additions. After that, I couldn't get any larger - float conversions gave me issues. Feel free to enhance/fix and give us an answer.(feels nice to inject some SQL here :-))set nocount ondeclare @MathTable table (uid int identity (1,1), Number dec(38,0), NumberText char(100))declare @Count int, @BaseNumber dec(38,0), @LoopCount intset @BaseNumber = 196set @Count = 1set @LoopCount = 100insert into @MathTable (Number,NumberText)select @BaseNumber,cast(@BaseNumber as char(100))select * from @MathTablewhile @Count < @Loopcount begin insert into @MathTable (Number,NumberText) select Number+cast(reverse(NumberText) as dec(38,0)), cast (Number+ (cast(reverse(NumberText) as dec(38,0))) as char(100)) from @MathTable where Uid = @Count set @Count = @Count + 1endselect uid, Number, case when NumberText = reverse(NumberText) then 'Is Palindrome' else ' NOT Palindrome' end as [Palindrome?]from @MathTable order by Uid desc Results:uid Number NumberText ----------- ---------------------------------------- ---------------------------------------------------------------------------------------------------- 1 196 196 Server: Msg 8115, Level 16, State 2, Line 17Arithmetic overflow error converting expression to data type numeric.The statement has been terminated.uid Number Palindrome? ----------- ---------------------------------------- --------------- 81 71233793175007298122189281057030833206 NOT Palindrome80 16474800379447118011108106559729985745 NOT Palindrome79 8787394689723559555548553279865047867 NOT Palindrome78 1797953072701241777777132207161449896 NOT Palindrome77 899477035806065888888571598630674898 NOT Palindrome76 171869639709643252636224690693706727 NOT Palindrome75 91385319354816681317562845302348408 NOT Palindrome74 45747659181913285659330927106673654 NOT Palindrome73 13258878097456662332665448018788423 NOT Palindrome72 7178889593228875666877224058899706 NOT Palindrome71 3589444802113893332894111974449853 NOT Palindrome70 1326313072829535757534829271313622 NOT Palindrome69 668656536414767878767414635656756 NOT Palindrome68 159876958854887988978955775977805 NOT Palindrome67 85383533877444544434477942439447 NOT Palindrome66 17671139534403958504034349321776 NOT Palindrome65 8836114272647029296571625205388 NOT Palindrome64 1712373124704184482497411473217 NOT Palindrome63 906182107397142240703710191608 NOT Palindrome62 182280281681549295517528109327 NOT Palindrome61 96640091285774647759309104658 NOT Palindrome60 17786453745152322604573635887 NOT Palindrome59 9442681822581660752291773438 NOT Palindrome58 1758434620324786522027424867 NOT Palindrome57 934217310162393261013712428 NOT Palindrome56 175837936477498486373973857 NOT Palindrome55 92918473189299188236491928 NOT Palindrome54 17537224026299926194218357 NOT Palindrome53 9264161958699957602603728 NOT Palindrome52 1751196640799987135692157 NOT Palindrome51 925153265399993573340628 NOT Palindrome50 175095833209091234750057 NOT Palindrome49 92502871604050616929528 NOT Palindrome48 18408442064004592449047 NOT Palindrome47 9749270977546801719568 NOT Palindrome46 1795298270686072793597 NOT Palindrome45 947154635293536341848 NOT Palindrome44 177104867844767940077 NOT Palindrome43 93507933867933969538 NOT Palindrome42 47248966933966985264 NOT Palindrome41 13305261530450734933 NOT Palindrome40 7197630720180367016 NOT Palindrome39 3603815405135183953 NOT Palindrome38 1317620482294916822 NOT Palindrome37 664304741147513356 NOT Palindrome36 159482241005228405 NOT Palindrome35 85191620502609247 NOT Palindrome34 17653692772973576 NOT Palindrome33 8827391431036288 NOT Palindrome32 4413700670963144 NOT Palindrome31 1400255515443103 NOT Palindrome30 755127757721546 NOT Palindrome29 159547977975595 NOT Palindrome28 84724043932847 NOT Palindrome27 17602285712176 NOT Palindrome26 8801197801088 NOT Palindrome25 1800098901007 NOT Palindrome24 900544455998 NOT Palindrome23 450822227944 NOT Palindrome22 130992928913 NOT Palindrome21 70446464506 NOT Palindrome20 16403234045 NOT Palindrome19 8746117567 NOT Palindrome18 1794102596 NOT Palindrome17 897100798 NOT Palindrome16 454050344 NOT Palindrome15 227574622 NOT Palindrome14 111589511 NOT Palindrome13 60744805 NOT Palindrome12 35322452 NOT Palindrome11 18211171 NOT Palindrome10 10755470 NOT Palindrome9 1067869 NOT Palindrome8 187088 NOT Palindrome7 94039 NOT Palindrome6 52514 NOT Palindrome5 13783 NOT Palindrome4 7436 NOT Palindrome3 1675 NOT Palindrome2 887 NOT Palindrome1 196 NOT Palindrome *##* *##* *##* *##* Chaos, Disorder and Panic ... my work is done here! |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-15 : 11:39:54
|
well i tried with this ... still nothing  private void button5_Click(object sender, EventArgs e){ulong n = 196;for (int i=0;i<10000000;i++){ ulong nRev; ulong.TryParse(Reverse(n.ToString()), out nRev); if (nRev == n ) txtResults.Text += n.ToString() + Environment.NewLine + Environment.NewLine; n = n + nRev;}txtResults.Text += "Done! " + Environment.NewLine + Environment.NewLine;}private string Reverse(string x){ char[] c = x.ToCharArray(); /*convert to chararray*/ int l = x.Length - 1; for (int i = 0; i < l; i++, l--) { c[i] ^= c[l]; c[l] ^= c[i]; c[i] ^= c[l]; } string s = new string(c); return s;} Go with the flow & have fun! Else fight the flow |
 |
|
jhermiz
3564 Posts |
Posted - 2006-03-15 : 13:27:01
|
quote: Originally posted by spirit1 well i tried with this ... still nothing  private void button5_Click(object sender, EventArgs e){ulong n = 196;for (int i=0;i<10000000;i++){ ulong nRev; ulong.TryParse(Reverse(n.ToString()), out nRev); if (nRev == n ) txtResults.Text += n.ToString() + Environment.NewLine + Environment.NewLine; n = n + nRev;}txtResults.Text += "Done! " + Environment.NewLine + Environment.NewLine;}private string Reverse(string x){ char[] c = x.ToCharArray(); /*convert to chararray*/ int l = x.Length - 1; for (int i = 0; i < l; i++, l--) { c[i] ^= c[l]; c[l] ^= c[i]; c[i] ^= c[l]; } string s = new string(c); return s;} Go with the flow & have fun! Else fight the flow 
I think this can be shown by induction.It doesn't seem to evaluate to a palindrome at any case, but I don't have enough room on this thread to prove it (ring a bell?) Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url] |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-03-15 : 13:34:08
|
it probably can be... but i'm no math geek Go with the flow & have fun! Else fight the flow |
 |
|
jhermiz
3564 Posts |
Posted - 2006-03-15 : 13:40:40
|
Ok I dont seem to get the first one for outside the box, it ends up being 42 from an episode of lost but look at this:http://www.research.att.com/~njas/sequences/?q=4%2C8%2C15%2C16%2C23&sort=0&fmt=0&language=english Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url] |
 |
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2006-03-15 : 17:35:27
|
Still no palindrome after 2000 digit numbers....Ok, the brute force attack was fun, I see a pattern!, oh no wait, maybe not, ah well.declare @s1 varchar(8000), @palindrome char(10)set @s1 = '59'--set @s1 = '196'select @s1 as seednumber-- loop and display...while len(@s1) < 8000begin select @s1 = dbo.addLarge(@s1, reverse(@s1)) if @s1 = reverse(@s1) or len(@s1)%100 = 0 begin set @palindrome = case when @s1 = reverse(@s1) then 'PALINDROME' else 'LEN='+ltrim(len(@s1)) end raiserror('%s : %s',0,1,@palindrome,@s1) with nowait endendif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[addLarge]') and xtype in (N'FN', N'IF', N'TF'))drop function [dbo].[addLarge]GO/* adds 2 large integer strings terribly slow algorithm though ...*/create function dbo.addLarge(@s1 varchar(7999), @s2 varchar(7999))returns varchar(8000) asbegin declare @s3 varchar(8000) ,@i int ,@rem int ,@result int select @rem = 0 ,@s3 = '' ,@s1 = case when len(@s1)<len(@s2) then replicate('0',len(@s2)-len(@s1)) + @s1 else @s1 end ,@s2 = case when len(@s2)<len(@s1) then replicate('0',len(@s1)-len(@s2)) + @s2 else @s2 end ,@i = len(@s1) while @i > 0 begin select @result = @rem + cast(substring(@s1,@i,1) as int) + cast(substring(@s2,@i,1) as int) ,@s3 = ltrim(@result%10) + @s3 ,@rem = @result/10 ,@i = @i - 1 end return case when @rem = 0 then '' else ltrim(@rem) end + @s3endgo _______________________Query cancelled by Userrockmooose |
 |
|
Next Page
|