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.

A343839 Semi-one numbers: Positive integers k such that exactly half of the integers 1..k have a 1 in their decimal expansion.

This page as a plain text file.
%I A343839 #49 Jun 23 2023 16:16:25
%S A343839 2,16,24,160,270,272,1456,3398,3418,3420,3422,13120,44686,118096,
%T A343839 674934,1062880
%N A343839 Semi-one numbers: Positive integers k such that exactly half of the integers 1..k have a 1 in their decimal expansion.
%C A343839 There are only these 16 semi-one numbers. That there can only be finitely many is fairly easy to show: consider how many 100-billion-digit numbers have no 1s in them. Eventually the proportion of 1-less numbers drops below 50% and stays there. 5217031 numbers up to 9999999 have a 1 in them so proportion of 1-ful numbers can't drop below 50% for numbers with more digits. Hence the search program can stop at 10 million.
%H A343839 Gary Gordon and Glen Whitney, <a href="http://digitaleditions.sheridan.com/publication/?i=483313&amp;article_id=3039776">The Playground</a>, Math Horizons vol XXV issue 4, April 2018, Problem C21, semi-one numbers (and other semi-n).
%e A343839 16 is semi-1 because 1,10,11,12,13,14,15,16 have a 1 in them, there are 8 such numbers, and 8 is half of 16. 2 is semi-1 because 1 has a 1 in it and 2 does not.
%t A343839 s = {}; c = 0; Do[If[DigitCount[n, 10, 1] > 0, c++]; If[n == 2*c, AppendTo[s, n]], {n, 1, 1062880}]; s (* _Amiram Eldar_, May 01 2021 *)
%t A343839 With[{nn=11*10^5},Select[Partition[Riffle[Range[nn],Accumulate[Table[If[DigitCount[n,10,1]>0,1,0],{n,nn}]]],2],#[[1]]==2#[[2]]&]][[;;,1]] (* _Harvey P. Dale_, Jun 23 2023 *)
%o A343839 (Perl)
%o A343839 for (1..10000000) {
%o A343839         if (/1/) {
%o A343839                 $s++;
%o A343839                 }
%o A343839         if ($_==2*$s) {
%o A343839                 print $_."\n";
%o A343839                 }
%o A343839         }
%o A343839 (PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, #va, va[n] = va[n-1] + (#select(x->(x==1), digits(n)) > 0);); for (n=1, nn, if (va[n] == n/2 , print1(n, ", ")););} \\ _Michel Marcus_, May 02 2021
%Y A343839 Cf. A011531, A344636.
%K A343839 nonn,base,fini,full
%O A343839 1,1
%A A343839 _Adam Atkinson_, May 01 2021