cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A004721 Delete all 2's from the sequence of nonnegative integers.

This page as a plain text file.
%I A004721 #21 Apr 22 2021 22:08:46
%S A004721 0,1,3,4,5,6,7,8,9,10,11,1,13,14,15,16,17,18,19,0,1,3,4,5,6,7,8,9,30,
%T A004721 31,3,33,34,35,36,37,38,39,40,41,4,43,44,45,46,47,48,49,50,51,5,53,54,
%U A004721 55,56,57,58,59,60,61,6,63,64,65,66,67,68,69,70,71,7,73,74,75
%N A004721 Delete all 2's from the sequence of nonnegative integers.
%t A004721 d[n_]:=IntegerDigits[n]; t={0}; Do[If[Union[d[n]]!={2},n=FromDigits[DeleteCases[d[n],2]]; AppendTo[t,n]],{n,75}]; t (* _Jayanta Basu_, May 17 2013 *)
%o A004721 (Python)
%o A004721 def A004721(n):
%o A004721     l = len(str(n))
%o A004721     m = 2*(10**l-1)//9
%o A004721     k = n + l - int(n+l < m)
%o A004721     return 1 if k == m else int(str(k).replace('2','')) # _Chai Wah Wu_, Apr 20 2021
%Y A004721 Cf. A004719, A004720, A004722, A004723, A004724, A004725, A004726, A004727, A004728.
%K A004721 base,nonn
%O A004721 0,3
%A A004721 _N. J. A. Sloane_