Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Determining uniqueness in a string

by LucaPette (Friar)
on Oct 02, 2005 at 09:28 UTC ( [id://496733]=note: print w/replies, xml ) Need Help??


in reply to Determining uniqueness in a string.

Hi, Unfortunately at this moment i can't test the speed of my little idea about your problem. Well, i think that a simple solution is to add all digits and test if the result is 45, infact the sum of all digits in a ten character string is 45 only where every digit from the set 0-9 occurs exactly once, according to the Gauss' formula (N*(N*1)/2). I hope that, in spite of my ugly english, this little idea can help someone.

Replies are listed 'Best First'.
Re^2: Determining uniqueness in a string
by Yzzyx (Beadle) on Oct 02, 2005 at 13:17 UTC
    9 + 8 + 7 + 6 + 5 + 4 + 1 + 1 + 2 + 2 = 45
      errare humanum est... your reply is an incitation for me to being more careful and above all testing my little ideas.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://496733]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-19 01:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found