Số Cullen thứ n: C_n = n * 2^n + 1.
Ví dụ triển khai (C++)
#include <bits/stdc++.h>
using namespace std;
unsigned get_cullen(unsigned n) {
return (1u << n) * n + 1;
}
int main() {
int n = 2;
cout << get_cullen(n);
return 0;
}
Đầu ra
9