login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004721 Delete all 2's from the sequence of nonnegative integers. 10

%I #21 Apr 22 2021 22:08:46

%S 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 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 55,56,57,58,59,60,61,6,63,64,65,66,67,68,69,70,71,7,73,74,75

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

%t 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 (Python)

%o def A004721(n):

%o l = len(str(n))

%o m = 2*(10**l-1)//9

%o k = n + l - int(n+l < m)

%o return 1 if k == m else int(str(k).replace('2','')) # _Chai Wah Wu_, Apr 20 2021

%Y Cf. A004719, A004720, A004722, A004723, A004724, A004725, A004726, A004727, A004728.

%K base,nonn

%O 0,3

%A _N. J. A. Sloane_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 08:29 EDT 2024. Contains 371905 sequences. (Running on oeis4.)