OFFSET
1,1
COMMENTS
For digits d of n if d = 6 make it 9 else if d = 9 make it 6.
However, numbers containing neither digit 6 nor 9 are not terms (cf. A222251).
PROG
(PARI) flip69(n) = { for(x=1, n, y=x; v=0; f=0; ln =length(Str(x)); a = vector(ln); forstep(j=ln, 1, -1, r = y%10; a[j]=r; if(r==6, a[j] = 9; f=1); if(r==9, a[j] = 6; f=1); y = floor(y/10); ); forstep(j=ln, 1, -1, v=v+a[j]*10^(ln-j) ); if(f, print1(v", ")); ) }
(Python)
def has69(s): return '6' in s or '9' in s
def flp69(s): return s.replace("6", "-").replace("9", "6").replace("-", "9")
def aupto(lim):
return [int(flp69(s)) for s in map(str, range(lim+1)) if has69(s)]
print(aupto(186)) # Michael S. Branicky, Sep 06 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Cino Hilliard, Nov 02 2003
STATUS
approved