A004722 Delete all digits 3 from the terms of the sequence of nonnegative integers.
0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 14, 15, 16, 17, 18, 19, 20, 21, 22, 2, 24, 25, 26, 27, 28, 29, 0, 1, 2, 4, 5, 6, 7, 8, 9, 40, 41, 42, 4, 44, 45, 46, 47, 48, 49, 50, 51, 52, 5, 54, 55, 56, 57, 58, 59, 60, 61, 62, 6, 64, 65, 66, 67, 68, 69, 70, 71, 72, 7, 74, 75, 76
Offset: 0
Links
- Alonso del Arte, Table of n, a(n) for n = 0..9999
Programs
-
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
-
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 *)
-
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
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
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
Comments