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.
%I A032822 #30 Jun 28 2025 18:10:29 %S A032822 1,4,11,14,41,44,111,114,141,144,411,414,441,444,1111,1114,1141,1144, %T A032822 1411,1414,1441,1444,4111,4114,4141,4144,4411,4414,4441,4444,11111, %U A032822 11114,11141,11144,11411,11414,11441,11444,14111,14114 %N A032822 Numbers whose set of base-10 digits is {1,4}. %H A032822 Vincenzo Librandi, <a href="/A032822/b032822.txt">Table of n, a(n) for n = 1..1000</a> %H A032822 <a href="/index/Ar#10-automatic">Index entries for 10-automatic sequences</a>. %F A032822 a(1)=1, a(2)=4; a(n) = 10*a(floor(n/2))+1 for n odd, otherwise a(n) = 10*a(floor((n-1)/2))+4. - _Bruno Berselli_, May 28 2012 %t A032822 Flatten[Table[FromDigits[#,10]&/@Tuples[{1,4},n],{n,5}]] (* _Vincenzo Librandi_, May 28 2012 *) %o A032822 (Magma) [n: n in [1..15000] | Set(IntegerToSequence(n, 10)) subset {1, 4}]; // _Vincenzo Librandi_, May 28 2012 %o A032822 (Maxima) a[1]:1$ a[2]:4$ a[n]:= if oddp(n) then 10*a[floor(n/2)]+1 else 10*a[floor((n-1)/2)]+4$ makelist(a[n],n,1,40); /* _Bruno Berselli_, May 28 2012 */ %o A032822 (Python) %o A032822 def a(n): return int(bin(n+1)[3:].replace('1', '4').replace('0', '1')) %o A032822 print([a(n) for n in range(1, 45)]) # _Michael S. Branicky_, May 13 2021 %o A032822 (Python) %o A032822 def A032822(n): return 3*int(bin(n+1)[3:])+(10**((n+1).bit_length()-1)-1)//9 # _Chai Wah Wu_, Jun 28 2025 %Y A032822 Cf. A020452 (primes). %K A032822 nonn,base,easy %O A032822 1,2 %A A032822 _Clark Kimberling_