[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] 4 Consecutive Letters (generalized)





On Tue, 15 Aug 2000, Tom Moertel wrote:
> Using a different approach, here's a generalized version that can
> easily be modified to find any linearly increasing (or decreasing)
> sequence of N characters.  Here it is in the "4 consecutive 
> increasing letters" mode:
> 
> perl -ne'((join"",map{$b=$a;($a=ord)-$b-1&&"x"}split//)=~/000/)&&print'

Here's an even more generalized version that finds words containing _any_
sequence of N letters with linear spacing in the alphabet:

  perl -ne'((join"",map{$b=$a;chr(($a=ord)-$b)}split//)=~/(.)\1{3}/s)&&print'

Note that the number in the braces should be N minus 2, since this counts
deltas, not characters, and one is already taken up by the (.).


> I couldn't find any six-letter sequences, increasing or decreasing.
> Perhaps somebody with a more exhaustive set of words can find
> one or two.

None in the YAWL.  It does have 37 words with 5-letter linear sequences,
all containing either "rolif" or "uroli".  The shortest examples of each
type are "prolific" and "urolith". 

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method."  -- Abigail in c.l.p.m




==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe