इस ट्यूटोरियल में, हम कलन नंबर खोजने के लिए एक प्रोग्राम पर चर्चा करेंगे।
इसके लिए हमें एक पूर्णांक प्रदान किया जाएगा। हमारा कार्य सूत्र का उपयोग करके उस स्थिति में कुलीन संख्या ज्ञात करना है -
2n* n + 1
उदाहरण
#include <bits/stdc++.h>
using namespace std;
//finding the nth cullen number
unsigned get_cullen(unsigned n){
return (1 << n) * n + 1;
}
int main(){
int n = 2;
cout << get_cullen(n);
return 0;
} आउटपुट
9