Search

# All Your Base 7 Are Belong to Us by CodeChum Solution - AskTheCode

CodeChum Programming Solution | C++ program to solve a sequence of numbers | AskTheCode

Problem:

All Your Base 7 Are Belong to Us by CodeChum.

MWAHAHA *evil laugh* ?

I am evil space person trying to invade your base, Base 7. I was sent here by my superiors to eradicate all intellectually inferior people, and I was told that people inside your base are part. I will give you chance, however. If you manage to solve this simple sequence of numbers, I will spare you and everyone inside Base 7.

### Input Format:

A single line containing an integer.

Input Sample:

5

### Output Format:

A single line containing n integers.

Output Sample:

4 9 21 40 66

### Code:

```#include  <iostream>
using namespace std;

int main(){
int n;
cin >> n;
int arr[n];
int prev = 4;
arr = prev;
for (int i = 1; i < n; i++){
arr[i] = prev + 7 * i - 2;
prev = arr[i];
}
for (int i = 0; i < n; i++)
cout << arr[i] << " ";
return 0;
}```

### Recent Posts

See All

#### Solubility - CodeChef Solution in Java and C++| AskTheCode

CodeChef May Long Challenge Solution | Solubility (SOLBLTY) solution | AskTheCode Solubility (SOLBLTY) solution Problem: Suppose for a unit rise in temperature, the solubility of sugar in water increa

#### Valid Paths CodeChef Solution in C++ | AskTheCode

CodeChef May Long Challenge Solution | Valid Paths (VPATH) solution | AskTheCode Valid Paths (VPATH) CodeChef solution Problem: You are given a tree with N nodes numbered from 1 to N. A set S of nodes

#### Modular Equation CodeChef May Long Challenge 2021 Soution | AskTheCode

CodeChef May Long Challenge Solution | Modular Equation (MODEQ) solution | AskTheCode Modular Equation (MODEQ) solution Problem: Given integers N and M, find the number of ordered pairs (a,b) such tha