MathGroup Archive 2003

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

Search the Archive

Re: Modular Arithmetic Problem?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39002] Re: [mg38975] Modular Arithmetic Problem?
  • From: Dr Bob <drbob at bigfoot.com>
  • Date: Fri, 24 Jan 2003 05:04:52 -0500 (EST)
  • References: <200301231304.IAA11717@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Is this what you did (essentially)?

Cases[(Sqrt[FromDigits[#1]] & ) /@
    Flatten[
       Outer[List, Range[9], {0}, Range[0, 9], Range[0, 9], {1}],
     4], _Integer]
%*%

{101, 201, 301}
{10201, 40401, 90601}

I haven't thought of a much smarter method, as yet, but here's a far less 
exhaustive search:

nSquare = Expand[FromDigits[{a, b, c}]^2]
nSquare /. List /@ Thread[c -> {1, 9}]
Flatten[% /. List /@ Thread[a -> {1, 2, 3}]]

At this point, it's clear that b=0, c=1, a=1, 2, or 3 gives three valid 
answers and that b can't be anything but 0 when a = 3, which narrows the 
field considerably.

nSquare /. List /@ Thread[c -> {1, 9}]
Flatten[% /. List /@ Thread[a -> {1, 2}]]
Flatten[% /. List /@ Thread[b -> Range[9]]]

Visual inspection shows no solutions among these, which can be verified as 
follows.

Cases[%, q_ /; 10^4 < q < 10^5]
Cases[%, q_ /; Mod[Floor[q/10^3], 10] == 0]

Alternatively, the following isn't too exhaustive, either:

nSquare = Expand[FromDigits[{a, b, c}]^2]
nSquare /. List /@ Thread[c -> {1, 9}]
Flatten[% /. List /@ Thread[a -> {1, 2, 3}]]
Flatten[% /. List /@ Thread[b -> Range[0, 9]]]
Cases[%, q_ /; 10^4 < q < 10^5]
Cases[%, q_ /; Mod[Floor[q/10^3], 10] == 0]

Bobby

On Thu, 23 Jan 2003 08:04:38 -0500 (EST), David Park <djmp at earthlink.net> 
wrote:

> Dear MathGroup,
>
> Steven Shippee asked me about methods of solving the following problem.
>
> Find the numbers n such that n^2 is a five digit number with 0 in the 
> second
> digit and 1 in the last digit. (i.e., x0xx1 where x is a digit 0..9).
>
> We know how to solve the problem by testing a list of all possible 
> candidate
> numbers. But is there a method that uses Solve and modular arithimetic or
> some other clever method? If one looks at the answers one would think 
> there
> must be.
>
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
>
>
>



-- 
majort at cox-internet.com
Bobby R. Treat



  • Prev by Date: Re: MathLink: how do I wrap and call a subroutine that should return nothing
  • Next by Date: Re: Re: Solutions for functions containing jump discontinuities
  • Previous by thread: Modular Arithmetic Problem?
  • Next by thread: RE: Modular Arithmetic Problem?