%I #12 May 04 2019 21:50:07
%S 1,2,12,121,21,212,1212,12121,2121,21212,121212,1212121,212121,
%T 2121212,12121212,121212121,21212121,212121212,1212121212,12121212121,
%U 2121212121,21212121212,121212121212,1212121212121,212121212121
%N a(n) is the smallest number not already present that permits the cyclic repetition of the path 1,2 of the digits in the sequence.
%C Conjecture. (1) If n > 1, and a(n) begins and ends with 1, then a(n+1) is obtained by deleting the initial 1 of a(n); (2) if a(n) begins with 1 and ends with 2 then a(n+1) is obtained by adding a final 1 to a(n); (3) if a(n) begins with 2 and ends with 1 then a(n+1) is obtained by adding a final 2 to a(n); (4) if a(n) begins and ends with 2 then a(n+1) is obtained by adding an initial 1 to a(n). This has been confirmed through a(140), which has 71 digits (and should be fairly easy to prove). - _John W. Layman_, Sep 22 2009
%F a(n+1) = (1/24)*((a(n) + 10^floor(1 + log_10(a(n))))*(((n-2) mod 4) + ((n-1) mod 4) + 7*(n mod 4) - 5*((n+1) mod 4)) + (10*a(n)+1)*(((n-2) mod 4) + 7*((n-1) mod 4) - 5*(n mod 4) + ((n+1) mod 4)) + (a(n) - 10^floor(log_10(a(n))))*(7*((n-2) mod 4) - 5*((n-1) mod 4) + (n mod 4) + ((n+1) mod 4)) + (10*a(n) + 2)*(-5*((n-2) mod 4) + ((n-1) mod 4) + (n mod 4) + 7*((n+1) mod 4))), with n >= 3 and a(1)=1, a(2)=2. - _Paolo P. Lava_, Oct 02 2009
%e Starting from 1,2 the next number must be 12 because after 1,2 we shall continue with a 1. But 1 is already in the sequence so we need to add a 2 -> 12. And so on.
%p P:=proc(i) local a,n; a:=2; print(1);print(2); for n from 3 by 1 to i do a:=1/24*((a+10^floor(1+evalf(log10(a),100)))*(((n-2) mod 4)+((n-1) mod 4)+7*(n mod 4)-5*((n+1) mod 4))+(10*a+1)*(((n-2) mod 4)+7*((n-1) mod 4)-5*(n mod 4)+((n+1) mod 4))+(a-10^floor(evalf(log10(a),100)))*(7*((n-2) mod 4)-5*((n-1) mod 4)+(n mod 4)+((n+1) mod 4))+(10*a+2)*(-5*((n-2) mod 4)+((n-1) mod 4)+(n mod 4)+7*((n+1) mod 4))); print(a); od; end: P(200); # _Paolo P. Lava_, Oct 02 2009
%Y Cf. A165301-A165307.
%K easy,base,nonn
%O 1,2
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Sep 14 2009
%E Terms a(21) onward from _John W. Layman_, Sep 22 2009
%E Edited by _N. J. A. Sloane_, Oct 06 2009
|