LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Numbers to score and identify a situation (https://www.linuxquestions.org/questions/programming-9/numbers-to-score-and-identify-a-situation-4175694546/)

tvc457 05-03-2021 08:48 AM

Quote:

Originally Posted by lucmove (Post 6246680)
By "numbers to score and identify a situation" I mean, for example, file permissions. 4, 2, 1, and 0 allow very unique and specific sum combinations that identify each specific situation and can be translated into one single number.

0 (0+0+0) – No permission.
1 (0+0+1) – Only execute permission.
2 (0+2+0) – Only write permission.
3 (0+2+1) – Write and execute permissions.
4 (4+0+0) – Only read permission.
5 (4+0+1) – Read and execute permission.
6 (4+2+0) – Read and write permissions.
7 (4+2+1) – Read, write, and execute permission.

Each sum is unique.

I don't know if there is a name for that specifically in math. Is there?

Anyway, how far can I go and how am I supposed to find other numbers?

The numbers used are all a power of 2:
1,2,4

So you just carry on: 1,2,4,8,16,32,...

It feels like you're missing the simple solution, or am I ?



I don't know what it's called, but every number in that list is the sum of all previous, plus 1. It's just like that ..


All times are GMT -5. The time now is 01:41 AM.