Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := []int{0, 1, 2, 3, 5, 7, 8, 9}
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		out := make([]int, 10)
		now := 0
		for n > 0 {
			out[now] = table[n%8]
			now++
			n /= 8
		}
		tmp := make([]string, 0)
		for i := now - 1; i >= 0; i-- {
			tmp = append(tmp, strconv.Itoa(out[i]))
		}
		fmt.Println(strings.Join(tmp, ""))
	}
}

C++: #include<iostream>
using namespace std;
#include <cmath>
int main(){
    int x;

    while(1){
        int p = 0;
        cin >> x;
        if(x == 0){
            break;
        }
        for (int i= 1; i <= x; i++) {
            int valueDigits = log10(i) + 1;
//            cout << "Case "<< i << "input:" << x << "桁数" << valueDigits  <<endl;
            for (int k = 1; k <= valueDigits; k++) {
                int warukazu = 10 *(k - 1);
                if (warukazu == 0) {
                    warukazu = 1;
                }
                int j = i % warukazu;
                cout << i  <<"watta:" << j << endl;
                if (j == 4 || j == 6) {
//                    cout << "dame:" << i << endl;
                    p++;
                }
            }
        }
        cout << ":" << p << endl;
    }
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int a[] = {0,1,2,3,5,7,8,9};
void solve(int n){
  if(!n) return;
  solve(n/8);
  cout << a[n%8];
}
int main(void){
  int n;
  while(cin >> n && n){
    solve(n);
    cout << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define inf (1<<29)
using namespace std;
typedef vector<pair<int, int> > vpii;

bool check(long n) {
    int digit;
    while(n > 0) {
        digit = n % 10;
        if(digit == 4 || digit == 6) {
            return false;
        }
        n /= 10;
    }
    return true;
}

int main() {
    long n, ans;
    while(true) {
        cin >> n;
        if(n == 0) {
             break;
        }
        ans = 0;
        while(n > 0) {
            while(!check(++ans)) {}
            n--;
        }
        cout << ans << endl;
    }
}

C++: #include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main() {
	long long n;
	while (cin >> n, n) {
		int b=1;
		long long m=0;
		while (n) {
			m += b*(n%8);
			n /= 8;
			b *= 10;
		}
		stringstream ss;
		string s;
		ss << m;
		ss >> s;
		ss.str("");
		ss.clear(stringstream::goodbit);
		for (int i=0; i<s.size(); i++) {
			if (s[i]=='4') s[i]='5';
			else if (s[i]=='5') s[i]='7';
			else if (s[i]=='6') s[i]='8';
			else if (s[i]=='7') s[i]='9';
		}
		ss << s;
		ss >> m;
		cout << m << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;

int table[]={0,1,2,3,5,7,8,9};

void solve(int n){
	if(n >= 8){
		solve(n/8);
	}
	cout << table[n%8];
}



int main(){
	int n;
	while(cin >> n){
		solve(n);
		cout << endl;
	}
}

C++: #include <iostream>
#include <sstream>
#include <cstdlib>
#include <string>
using namespace std;

void convert(string& n) {
    for (int i = 0; i < n.size(); i++) {
        switch (n[i]) {
            case '1': case '2': case '3':
                break;
            case '4':
                n[i] = '5'; 
                break;
            case '5': case '6': case '7':
                n[i] = n[i] + 2;
                break;
        }
    }
}

int main() {
    int n;
    while (cin >> n, n != 0) {
        ostringstream ss;
        ss << oct << n;
        string ns = ss.str();
        convert(ns);
        cout << ns << endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

int getValue(int x){
    if ( x == 4 ) return 5;
    return (x < 4) ? x : x+2;
}

void convert( int n ){
    if ( n == 0 ) return;
    convert( n/8 );
    cout << getValue(n%8);
}

main(){
    int n;
    while( cin >> n && n ) { convert(n); cout << endl; }
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main() {

	int i, n, count;
	char s1[64];
	char s2[2]="4";
	char s3[2]="6";

	while(cin >> n) {
		count=0;
		if(n>1000000000)
			continue;
		else if(n==0)
			break;
		for(i=1; i<=n; i++) {
			count++;
			sprintf(s1, "%d", count);
			while((strpbrk(s1, s2)!=NULL)||(strpbrk(s1, s3)!=NULL)) {
				count++;
				sprintf(s1, "%d", count);
			}
		}
		cout << count << endl;
	}

	return 0;

}

C++: #include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

typedef long long ll;


int fourOrSixPlace(ll num){
	int idx=-1;
	int cnt=0;
	while(num>0){
		if(num%10==6||num%10==4){
			idx=cnt;
		}
		num/=10;
		cnt++;
	}
	return idx;
}

int main(){

	//int cc=0;
	//for(ll i = 1; i <= 100000; i++){
	//	int ret=fourOrSixPlace(i);
	//	if(ret!=-1)
	//		cc++;
	//}
	//cout<<cc<<endl;
	ll n;
	while(cin>>n&&n!=0){
		ll cnum=0;
		ll cnt=0;
		while(1){
			cnum+=100000;
			if(cnum>n)
				break;
			int ret=fourOrSixPlace(cnum);
			if(ret==-1){
				n+=67232;
			}
			else{
				n+=67232;
				cnum+=(ll)(pow(10.0,ret)+0.1);
				n+=(ll)(pow(10.0,ret)+0.1);
			}
		}
		if(cnum==n){
			cout<<n<<endl;
		}
		else{
			cnum-=100000;
			cnum++;
			for(ll i = cnum; i <= n; i++){
				int ret=fourOrSixPlace(i);
				if(ret!=-1){
					if(ret==0){
						n++;
					}
					else{
						n+=(ll)pow(10.0,ret);
						i+=(ll)pow(10.0,ret);
					}
				}
			}
		}
		cout<<n<<endl;
	}

	return 0;
}

C++: #include <cstdio>

using namespace std;

void conv(int t)
{
	char tbl[] = "01235789";
	bool flag = false;
	
	for (int i = 30; i >= 0; i -= 3){
		if (flag == true || (t >> i) & 7){
			flag = true;
			printf("%c", tbl[(t >> i) & 7]);
		}
	}
	
	printf("\n");
}

int main()
{
	int n;
	
	while (scanf("%d", &n) && n){
		conv(n);
	}
	
	return (0);
}

C++: #include <iostream>

using namespace std;

int main(){
  char newnum[8] = {0,1,2,3,5,7,8,9};
  long input_num;

  int count_num;
  while(cin >> input_num && input_num != 0){
    //    output_num = 0;
    count_num = 0;
  long output_num[13]={0};
    while(input_num != 0){
      output_num[count_num] = newnum[input_num % 8];
      input_num /= 8;
      //      cout << output_num << " " ;
      count_num++;
    }
    for(int j=count_num;j>0;j--){
      output_num[j-1] += output_num[j] * 10;
      //      cout << output_num[j] << " ";
    }

    cout << output_num[0];
    cout << endl;
  }

}

C++: #include <stdio.h>
#include <list>

using namespace std;

int main(){
  while(1){
    int v;
    scanf("%d", &v);
    if(v==0) break;

    int i;
    list<int> data;
    for(i=0;v;i++){
      switch(v%8){
      case 0:
      case 1:
      case 2:
      case 3:
        data.push_back(v%8);
        break;
      case 4:
        data.push_back((v%8)+1);
        break;
      case 5:
      case 6:
      case 7:
        data.push_back((v%8)+2);
        break;
      }
      v /= 8;
    }

    v = data.size();
    for(i=0;i<v;i++){
      printf("%d", data.back());
      data.pop_back();
    }
    puts("");
  }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    long long n;
    while(cin >> n && n)
    {
        string ans = "";
        int rest;
        while(n)
        {
            rest = (int)(n % 8);

            if(rest==0) ans = "0" + ans;
            if(rest==1) ans = "1" + ans;
            if(rest==2) ans = "2" + ans;
            if(rest==3) ans = "3" + ans;
            if(rest==4) ans = "5" + ans;
            if(rest==5) ans = "7" + ans;
            if(rest==6) ans = "8" + ans;
            if(rest==7) ans = "9" + ans;

            n /= 8;
        }
        cout << ans << endl;

    }
    return 0;
}