Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Determining uniqueness in a string

by LucaPette (Friar)
on Oct 02, 2005 at 09:28 UTC ( #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? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2022-01-17 11:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (51 votes). Check out past polls.

    Notices?