MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Numbers and their reversals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53712] Re: Numbers and their reversals
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Mon, 24 Jan 2005 03:37:37 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 1/23/05 at 2:02 AM, towtoo2002 at yahoo.com (F. omari) wrote:

>
>i want to investigate the following two equations: a * const = z
>a_Reversed * const = z_Reversed where a, z, and their reversed form
>and const are all positive integers ie such that: 2684 * 17 = 45628
>4862 * 17 = 82654 2986 * 91 = 271726 6892 * 91 = 627172 it happened
>that many multipliers of 91 have such a property. while the
>multipliers of 17 have only 5 cases in the interval of 1 to 3000
>the following code will investigate the multipliers of 17, to
>investigate another number just replace 17. and you may increase
>the interval of investigation. i am sure that my code is an old
>fashion one, please any other ideas about a more functional code. 

>a = Table[i, {i, 1, 3000}]; zR = ""; aR = 0; z = "";
>Do[aR = ToExpression[StringReverse[ToString[a[[i]]]]];
>        z = ToString[a[[i]]*17];
>       zR = StringReverse[ToString[aR*17]];
>       If[zR == z, Print[a[[i]]]], {i, 1, 3000}]

The same result can be achieved using

Select[Range@3000, 
   IntegerDigits[17 #] == 
     Reverse@IntegerDigits[17 FromDigits@Reverse@
          IntegerDigits[#]]&]

As an added bonus it runs a bit more than twice as fast OMM
--
To reply via email subtract one hundred and four


  • Prev by Date: Why IntervalBisection can't operate on InterpolatingFunction
  • Next by Date: Re: Problems with ExtendGraphics/Delaunay Triangulation
  • Previous by thread: Re: Numbers and their reversals
  • Next by thread: Re: Numbers and their reversals