Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating easy to remember numbers

Is it possible to generate random numbers between say 1000000 and 9999999 that are easy to remember?

I know the term easy to remember is relative but I'd believe that for your typical human being the number 331332 is easier to remember than 537106 (or is it?)

Use case. Am generating unique numbers for people in an application and was thinking I could try and make it easier for the people by assigning them easy numbers. The way I'd play it is that the first people to register get the easy numbers and from there the easiness reduces.

If you've seen the same in any programming language you could post for inspiration to others

There's a similar question here but that was alphanumeric in nature and it was six years ago

like image 289
lukik Avatar asked Dec 06 '25 18:12

lukik


2 Answers

Here I've found some things which make a number memorable: http://www.slideshare.net/cntryrckr69/what-makes-a-number-memorable

I've implemented it in python based on a few of these things

Here's what the code looks like:

import random

def easynum(num):
    num = str(num)

    if len(set(num)) <= 2: # common characters eg. 1114111
        print("common")
        return True
    if num == num[::-1]: # its the same backwards eg. 1234321
        print("reversible")
        return True
    if all(x <= y for x, y in zip(list(num), list(num)[1:])): # increasing, e.g. 123456789
        print("increasing")
        return True
    if all(x >= y for x, y in zip(list(num), list(num)[1:])): # decreasing
        print("decreasing")
        return True


for count in range(10):
    rand = random.randint(1000000, 9999999)
    while easynum(rand) == None:
        rand = random.randint(1000000, 9999999)
    print(rand)

Here's the output I got:

reversible
5691965
reversible
9585859
increasing
1112557
reversible
9057509
reversible
3831383
decreasing
8322000
increasing
1122356
common
4884484
decreasing
9887320
common
4004040
like image 165
Tom Fuller Avatar answered Dec 09 '25 12:12

Tom Fuller


I can think of a few easy to remember patterns:

1234321 (half reversed)
1234567 (in order)
1231231 (repeating)
7654321 (reverse order)
2468024 (even in order)
1357135 (odd in order)
1212121 (alternating)

There are obviously more you can think of. Have a library of different patterns. Randomly select a pattern from the library and then randomly populate that pattern, within the constraints of the pattern. For example, you can only select the starting digit of the 'in order' pattern, the following digits will depend on the starting digit.

like image 21
rossum Avatar answered Dec 09 '25 11:12

rossum