login
Count of times n appears in number created by stringing together previous n-1 integers
1

%I #9 Apr 16 2023 13:24:15

%S 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,1,

%T 0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,1,1,1,1,0,1,0,0,0,0,1,1,1,1,1,0,1,0,

%U 0,0,1,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1

%N Count of times n appears in number created by stringing together previous n-1 integers

%C 2 first appears for n=121; 3 first appears for n=1011; 4 first appears for n=1121; 5 first appears for n=10111. - _Harvey P. Dale_, Jul 22 2013

%e a(6)=0 because stringing together the first 5 integers gives the number "12345" and 6 does not appear in 12345.

%e a(12)=1 because stringing together the first 11 integers gives "1234567891011" and 12 appears once in 1234567891011 (right at the beginning).

%t Table[idn=IntegerDigits[n];fid=Flatten[IntegerDigits/@Range[n-1]];Count[ Partition[ fid,Length[idn],1],idn],{n,0,110}] (* _Harvey P. Dale_, Jul 22 2013 *)

%t Table[SequenceCount[Flatten[IntegerDigits/@Range[n-1]],IntegerDigits[n]],{n,120}] (* _Harvey P. Dale_, Apr 16 2023 *)

%o (PHP) for($x = 1; $x <= 1000; $x++) {

%o echo "$x: " . substr_count($running, $x) ."<br />" ;

%o $running = $running . $x ;

%o }

%K nonn,base

%O 1,1

%A _Dominick Cancilla_, Jul 27 2010