Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[1000],p=0,m=0,n,i;
- cin>>n;
- a[0]=1;
- while (m<n)
- {
- m++;a[m]=2*a[p]+1;
- m++;a[m]=3*a[p]+1;
- p++;
- }
- for (i=0;i<n;i++)
- cout<<a[i]<<' ';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement