OFFSET
0,3
COMMENTS
Very similar to A004178, except that 3-repdigits (A002277) are completely removed from the sequence, whereas A004178 has 0's in their place. It is thus guaranteed that a(n) = n only when n < 3. - Alonso del Arte, Oct 18 2012
LINKS
Alonso del Arte, Table of n, a(n) for n = 0..9999
FORMULA
a(n) = n for -1 < n < 3;
a(n) = A004178(n + 1) for 2 < n < 32,
a(n) = A004178(n + 2) for 31 < n < 331,
a(n) = A004178(n + 3) for 330 < n < 3330,
a(n) = A004178(n + 4) for 3329 < n < 33329, etc. - Alonso del Arte, Oct 21 2012
MATHEMATICA
endAt = 103; Delete[Table[FromDigits[DeleteCases[IntegerDigits[n], 3]], {n, 0, endAt}], Table[{(10^expo - 1)/3 + 1}, {expo, Floor[Log[10, endAt]]}]] (* Alonso del Arte, Apr 29 2019 *)
PROG
(MATLAB) m=1;
for u=0:1000
v=dec2base(u, 10)-'0'; v = v(v~=3);
if length(v)>0; sol(m)=(str2num(strrep(num2str(v), ' ', ''))); m=m+1; end;
end
sol % Marius A. Burtea, May 07 2019
(Python)
def A004722(n):
l = len(str(n))
m = (10**l-1)//3
k = n + l - int(n+l < m)
return 2 if k == m else int(str(k).replace('3', '')) # Chai Wah Wu, Apr 20 2021
CROSSREFS
KEYWORD
base,nonn
AUTHOR
EXTENSIONS
Sean A. Irvine pointed out erroneous terms in b-file and confirmed correction, Apr 28 2019
Name edited by Felix Fröhlich, Apr 29 2019
STATUS
approved