Untitled
unknown
c_cpp
2 years ago
569 B
6
Indexable
#include <bits/stdc++.h>
using namespace std;
vector<int> seq;
int solution(int N) {
if (seq.size() == 0) {
for (int i = 1; seq.size() < 203; i++) {
int num = i;
while (num % 2 == 0)
num = num / 2;
while (num % 3 == 0)
num = num / 3;
if (num == 1)
seq.push_back(i);
}
}
return seq[N];
}
int main() {
for (int i = 0; i <= 200; i++)
cout << "A[" << i << "] = " << solution(i) << endl;
return 0;
}Editor is loading...