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<cstdio>
int main(){
  long long int n,cont;
  while(1){
    cin>>n;
    if(!n)break;
    cont=0;
    long long int f;
     for(long long int i=1;i<=n+cont;i++){
      f=i;
      while(i){
	if(i%10==4 || i%10==6){
	  cont++;
	  break;
	}
	i/=10;
      }
      
      i=f;
    }
    cout<<cont+n<<endl;
  }
}

C++: #include <iostream>

using namespace std;

int main () {
    long int l, n, m;
    while (cin >> n, n) {
          m = 1;
          for (long int i = 1; i < n; ++i) {
              ++m;
              l = m;
              for (int j = 1; l; j *= 10) {
                  long int x;
                  x = (l % (j * 10)) / j;
                  l -= x;
                  if (x == 6 || x == 4) m += j;
              }
          }
          cout << m << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const int mod = 1000000007;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s = "01235789";
  ll k;
  while(cin >> k && k){
    string s2;
    while(k){
      int n = k % 8;
      s2 += s[n];
      k /= 8;
    }
    reverse(all(s2));
    cout << s2 << endl;
  }
  return 0;
}

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

int main(){
  int i,j;
  int n;
  int a[10];

  while(1){
    cin >> n;
    if(!n)break;

    j = 0;
    while(1){
      a[j] = n%8;
      n /= 8;
      if(!n)break;
      j++;
    }

    for(i=j;i>=0;i--){
      if(a[i]<4)cout << a[i];
      else if(a[i]<5)cout << a[i]+1;
      else cout << a[i]+2;
    }
    cout << endl;
  }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  while(1){
    cin>>n;
    if(n==0)break;
    stack<int> s;
    while(n){
      s.push(n%8);
      n/=8;
    }
    while(s.size()){
      int a=s.top();
      s.pop();
      int d[8]={0,1,2,3,5,7,8,9};
      cout<<d[a];
    }
    cout<<endl;
  }
}

C++: #include <iostream>
#include <vector>
using namespace std;
int n[] = { 0,1,2,3,5,7,8,9 };

int main() {
	while(true){
	vector<int>v;
	long long num;
	cin >> num;
	if (num == 0) return 0;
	while (num >= 1) {
		v.push_back(n[num % 8]);
		num /= 8;
	}
	for (int i = v.size() - 1; i >= 0; i--) cout << v[i];
	cout << endl;
}
}

C++: #import<cstdio>
s(int n){if(n>7)s(n/8);printf("%d",n%8<4?n%8:n%8<6?n%8+1:n%8+2);}main(){for(int a;scanf("%d",&a),a;puts(""))s(a);}

C++: #include <cstdio>
#include <vector>
using namespace std;

int main() {
	vector<int> a;
	while(1) {
		int x = 0;
		scanf("%d", &x);
		a.push_back(x);
		if(x==0)break;
	}
	
	int l = a.size()-1;
	int b[l];
	
	for(int i=0;i<l;i++) {
		int a1 = a[i];
		int v = 0;
		for(int j=1;0<a1;j*=10) {
			int t = a1%8;
			if(t>4) {
				t+=2;
			}else if(t>3) {
				t+=1;
			}
			v += t*j;
			a1 /= 8;
		}
		b[i] = v;
	}
	
	for(int i=0;i<l;i++) {
		printf("%d\n", b[i]);
	}
	
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>

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

int main(){
	while(true){
		int n;
		scanf("%d", &n);
		if(n == 0){ break; }
		long long answer = 0, e = 1;
		while(n != 0){
			int m = n % 8;
			answer += e * table[m];
			e *= 10;
			n /= 8;
		}
		printf("%lld\n", answer);
	}
	return 0;
}

C++: 1>------ rhJn: vWFNg: algo, \¬: Release Win32 ------
1>2011/07/23 16:18:47 ÉrhðJnµÜµ½B
1>InitializeBuildStatus:
1>  "AlwaysCreate" ªwè³ê½½ß "Release\algo.unsuccessfulbuild" ðì¬µÄ¢Ü·B
1>ClCompile:
1>  0208.cpp
1>Link:
1>  R[h¶¬µÄ¢Ü·B
1>  R[h¶¬ªI¹µÜµ½B
1>  algo.vcxproj -> C:\Users\Roak\Documents\Visual Studio 2010\Projects\algo\Release\algo.exe
1>FinalizeBuildStatus:
1>  t@C "Release\algo.unsuccessfulbuild" ðíµÄ¢Ü·B
1>  "Release\algo.lastbuildstate" Ì^b` ^XNðÀsµÄ¢Ü·B
1>
1>rhÉ¬÷µÜµ½B
1>
1>oßÔ 00:00:02.16
========== rh: 1 ³íI¹A0 ¸sA0 XVsvA0 XLbv ==========

C++: #include <iostream>
#include <cstdio>
#include <cstring>

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==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 <vector>
#include <algorithm>

std::vector<int> ToOctalNumber(int n){
	std::vector<int> res;
	while(n){
		res.push_back((n&7)<4?n&7:(n&7)==4?5:(n&7)+2);
		n >>= 3;
	}
	std::reverse(res.begin(), res.end());
	return res;
}

int main(){
	int n;
	while(std::cin >> n, n){
		std::vector<int> sample = ToOctalNumber(n);
		for(int i=0;i<sample.size();i++){
			std::cout << sample[i];
		}
		std::cout << "\n";
	}
}

C++: #include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = (j); i < (k); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
int main(){
	int n;
	while(scanf("%d",&n),n){
		char ch[]="01235789";
		string ans = "";
		int cnt=0;
		while(n!=0){
			ans+=ch[n%8];
			n/=8;
		}
		reverse(ans.begin(),ans.end());
		cout << ans << endl;
	}
	return 0;
}