Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: (Efficiency Golf) Triangular numbers

by Zaxo (Archbishop)
on Jun 01, 2001 at 00:06 UTC ( #84721=note: print w/replies, xml ) Need Help??


in reply to Re: (Efficiency Golf) Triangular numbers
in thread (Efficiency Golf) Triangular numbers

If anyone has an elegant way of deleting the cases where we have duplicate characters I would love to see it. My 2 line regex is functional, but fairly agricultural!

I won't claim elegance, but above I constructed character classes on the fly for that. Each partial solution like ($T,$H,$R,$E,$N) is used to form "[^$T$H$R$E$N]". That is applied to 3-digit candidates which are already filtered for unlike digits.

After Compline
Zaxo

Update: Rereading your statement, I saw I'd filtered that too :-) I used $_ !~ m/(\d)\d*\1/g to filter out matching digits.

  • Comment on Re: Re: (Efficiency Golf) Triangular numbers

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://84721]
help
Chatterbox?
[hippo]: The thesholds/benefits balance at the time was nuts.
[hippo]: But that doesn't last because, you know ... politicians. :(
[Corion]: hippo: Yeah, if you still get enough money to get by and don't have expensive hobbies or other fixed costs that can work out well
[ambrus]: ah good. I pay only rent too. but that still costs significant money.
[Corion]: ambrus: Yes, but that is already budgeted for
[holli]: Corion is well off. I am sure there is a script of his running in the frankfurt banking data center, diligently mining bitcoins ;-)
[Corion]: holli: Hahaha :-D

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2017-09-21 15:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (249 votes). Check out past polls.

    Notices?