Fundamentals 8 min read

What’s the Real Range of Tencent QQ Numbers and How Bitmap Handles Their Deduplication?

The article explains the theoretical minimum and maximum of Tencent QQ numbers, why the lower bound starts at 10001, what would happen if all IDs were exhausted, and how a bitmap can efficiently represent and deduplicate billions of QQ IDs using simple C++ code.

Liangxu Linux
Liangxu Linux
Liangxu Linux
What’s the Real Range of Tencent QQ Numbers and How Bitmap Handles Their Deduplication?

1. QQ Number Range

QQ numbers are stored as a 4‑byte unsigned integer (uint32), so their theoretical value range is [0, 2^32‑1] (0 to 4,294,967,295). In practice the backend enforces a lower bound of 10001, a legacy setting from early QQ versions. Numbers close to the lower bound tend to be older, more “prestigious” accounts.

The maximum 10‑digit value (4294967295) is about 4.3 billion, which explains why QQ numbers have never exceeded 11 digits.

2. What Happens When All QQ Numbers Are Used?

Because QQ’s active user base is far below 4.3 billion and Tencent imposes registration limits, the ID space will not be exhausted in the foreseeable future. Inactive accounts may be reclaimed, but the exact reclamation logic is not disclosed. If the space ever ran out, Tencent would need to redesign its ID system.

3. Bitmap’s Connection to QQ Numbers

Interview questions often use the QQ‑ID scenario to test knowledge of bitmap techniques for deduplication. A bitmap uses one bit per possible ID to indicate presence (1) or absence (0). With 512 MB of memory (4 GB ÷ 8), you can represent all 2^32 possible QQ numbers.

Example bitmap implementation in C++:

#include <iostream>
#include <set>
#include <cstring>
using namespace std;

#define N 20          // example range 0‑19
#define SHIFT 5
#define MASK 0x1f
unsigned int a[1 + N / 32] = {0};

// set bit i to 1
void setOne(int i) { a[i >> SHIFT] |= (1 << (i & MASK)); }
// set bit i to 0
void setZero(int i) { a[i >> SHIFT] &= ~(1 << (i & MASK)); }
// get state of bit i
int getState(int i) { return (a[i >> SHIFT] & (1 << (i & MASK))) ? 1 : 0; }

int main() {
    setOne(1); setOne(3); setOne(4); setOne(9);
    for (int i = 0; i < N; ++i) {
        cout << i << " state: " << getState(i) << endl;
    }
    return 0;
}

Running the program prints the presence (1) or absence (0) of each number in the example range, demonstrating how a bitmap can both mark and deduplicate IDs.

Thus, understanding the QQ ID range and bitmap representation provides a practical illustration of how large‑scale identifier systems can be managed efficiently.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BitmapdeduplicationQQC++ID range
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.