Well, yeah, I guess so.
How about this: Instead of the code being one number, it's four separate numbers, one each in it's own variable.
Then there's a computerSum variable in the computer that adds them all up.
Then there's another variable called buttonSum that is empty, waiting for the player to enter numbers.
Then there's a counter that counts the number of button presses.
When the player pushes a button, a quick check is made to see if that number matches any of the pieces of the code. If so, it adds the number to buttonSum. If not, then buttonSum and the counter are reset to 0.
When the counter reaches 4, then buttonSum and computerSum are compared. If they're the same, the door opens. If not, then buttonSum and the counter are reset to 0.