Re: Numbers and their reversals
- To: mathgroup at smc.vnet.net
- Subject: [mg53714] Re: [mg53687] Numbers and their reversals
- From: DrBob <drbob at bigfoot.com>
- Date: Mon, 24 Jan 2005 03:37:43 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
There are actually LOTS of solutions. Here's a verification of the ones you listed, including OTHER factors that work (other than 17 and 91). I'm not counting trivial cases where the product is its own reverse. Clear[omariQ, omariD] reverse = FromDigits@Reverse@IntegerDigits@# &; commonDivisors = Rest@Divisors@GCD[#, reverse@#] &; omariQ[n_Integer, k_Integer] := n != reverse@n && IntegerQ[n/k] && reverse[n/k] == reverse[n]/k omariD[n_Integer] := Select[commonDivisors@n, omariQ[n, #] &] omariQ[n_Integer] := Length@omariD@n > 0 omariD /@ {45628, 271726, 82654, 627172} omariQ /@ {45628, 271726, 82654, 627172} {{17,34,187,374},{91},{17,34,187,374},{91}} {True,True,True,True} And this counts the 5-digit numbers that can be factored that way: Timing@Length@Select[Range[10000, 99999], omariQ] {4.5 Second, 5887} That's more than 6.5% of numbers in the range. If we want only those for which 17 can be the common factor, here they are up to 5 digits: Timing@Select[Range@99999, omariQ[#, 17] &] {1.296 Second, {41140, 45628, 82280, 82654}} 91 yields quite a few more choices: Timing@Select[Range@99999, omariQ[#, 91] &] {1.25 Second, {10010, 11102, 12012, 12103, 13013, 13104, 14014, 14105, 15015, 15106, 16016, 16107, 17017, 17108, 18018, 18109, 20020, 20111, 21021, 21203, 22113, 22204, 23023, 23114, 23205, 24024, 24115, 24206, 25025, 25116, 25207, 26026, 26117, 26208, 27027, 27118, 27209, 30030, 30121, 30212, 31031, 31122, 31304, 32032, 32214, 32305, 33124, 33215, 33306, 34034, 34125, 34216, 34307, 35035, 35126, 35217, 35308, 36036, 36127, 36218, 36309, 40040, 40131, 40222, 40313, 41041, 41132, 41223, 41405, 42042, 42133, 42315, 42406, 43043, 43225, 43316, 43407, 44135, 44226, 44317, 44408, 45045, 45136, 45227, 45318, 45409, 50050, 50141, 50232, 50323, 50414, 51051, 51142, 51233, 51324, 51506, 52052, 52143, 52234, 52416, 52507, 53053, 53144, 53326, 53417, 53508, 54054, 54236, 54327, 54418, 54509, 60060, 60151, 60242, 60333, 60424, 60515, 61061, 61152, 61243, 61334, 61425, 61607, 62062, 62153, 62244, 62335, 62517, 62608, 63063, 63154, 63245, 63427, 63518, 63609, 70070, 70161, 70252, 70343, 70434, 70525, 70616, 71071, 71162, 71253, 71344, 71435, 71526, 71708, 72072, 72163, 72254, 72345, 72436, 72618, 72709, 80080, 80171, 80262, 80353, 80444, 80535, 80626, 80717, 81081, 81172, 81263, 81354, 81445, 81536, 81627, 81809, 90090, 90181, 90272, 90363, 90454, 90545, 90636, 90727, 90818}} Bobby On Sun, 23 Jan 2005 02:02:17 -0500 (EST), F. omari <towtoo2002 at yahoo.com> 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}] > > 242 > 484 > 2442 > 2662 > 2684 > regards > > > > > -- DrBob at bigfoot.com www.eclecticdreams.net