       Re: Finding extra digit

• To: mathgroup at smc.vnet.net
• Subject: [mg53986] Re: Finding extra digit
• From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
• Date: Sun, 6 Feb 2005 00:44:55 -0500 (EST)
• References: <cu208g\$m0j\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```This example does the sort of thing you want:

Define a couple if integers differing by one digit.
In:= {n1,n2}={1234567,1234568};

Split the integers into their component digits.
In:= {d1,d2}=Map[IntegerDigits,{n1,n2}]
Out= {{1,2,3,4,5,6,7},{1,2,3,4,5,6,8}}

Find the digits the integers have in common
In:= i=Intersection[d1,d2]
Out= {1,2,3,4,5,6}

Find which digits of n2 do NOT lie in the above common set.
In:= Complement[d2,i]
Out= {8}

This also produces useful results when the integers differ by more than one
digit, or when the integers have an unequal number of digits.

Steve Luttrell

"Zak Seidov" <seidovzf at yahoo.com> wrote in message
news:cu208g\$m0j\$1 at smc.vnet.net...
> Dear Math gurus,
> What is an easy way to find extra digit in the integer n2,
> which differs from integer n1
> EXACTLY by ONE digit.
> I use a very dirt program,
> but guess that you can suggest smth (much) better.
> Thanks a lot,