OFFSET
1,3
COMMENTS
This is a frequent sequence on Chinese, Japanese and Korean elevator buttons. - Jean-Sebastien Girard (circeus(AT)hotmail.com), Jul 28 2008
Essentially numbers in base 9 (using digits 0, 1, 2, 3, 5, 6, 7, 8, 9 rather than 0-8). - Charles R Greathouse IV, Oct 13 2013
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
M. F. Hasler, Numbers avoiding certain digits OEIS wiki, Jan 12 2020.
Eric Weisstein's World of Mathematics, Uban Number
Wikipedia, Tetraphobia.
FORMULA
a(n) = replace digits d > 3 by d + 1 in base-9 representation of n - 1. - Reinhard Zumkeller, Oct 07 2014
Sum_{k>1} 1/a(k) = A082833 = 21.327465... (Kempner series). - Bernard Schott, Jan 12 2020, edited by M. F. Hasler, Jan 13 2020
MAPLE
a:= proc(n) local l, m; l, m:= 0, n-1;
while m>0 do l:= (d->
`if`(d<4, d, d+1))(irem(m, 9, 'm')), l
od; parse(cat(l))/10
end:
seq(a(n), n=1..100); # Alois P. Heinz, Aug 01 2016
MATHEMATICA
Select[Range[100], DigitCount[#, 10, 4] == 0 &] (* Alonso del Arte, Oct 13 2013 *)
PROG
(PARI) g(n)= local(x, v, j, flag); for(x=1, n, v=Vec(Str(x)); flag=1; for(j=1, length(v), if(v[j]=="4", flag=0)); if(flag, print1(x", ") ) ) \\ Cino Hilliard, Apr 01 2007
(PARI)
apply( {A052406(n)=fromdigits(apply(d->d+(d>3), digits(n-1, 9)))}, [1..99]) \\ a(n)
next_A052406(n, d=digits(n+=1))={for(i=1, #d, d[i]!=4|| return((1+n\d=10^(#d-i))*d)); n} \\ least a(k) > n. Used for A038612. - M. F. Hasler, Jan 11 2020
(Magma) [ n: n in [0..89] | not 4 in Intseq(n) ]; // Bruno Berselli, May 28 2011
(sh) seq 0 1000 | grep -v 4; # Joerg Arndt, May 29 2011
(Haskell)
a052406 = f . subtract 1 where
f 0 = 0
f v = 10 * f w + if r > 3 then r + 1 else r where (w, r) = divMod v 9
-- Reinhard Zumkeller, Oct 07 2014
(Python) def A052406(n): n-=1; return sum((d+(d>3))*10**i for d, i in ((n//9**i%9, i) for i in range(math.ceil(math.log(n+1, 9))))) # M. F. Hasler, Jan 13 2020
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Henry Bottomley, Mar 13 2000
EXTENSIONS
Offset changed by Reinhard Zumkeller, Oct 07 2014
STATUS
approved