login
a(n) is the smallest number not already in the sequence, such that the concatenation of all a(n) displays the periodic digit string 1, 2, 3, 4, 5 (and repeat).
4

%I #6 May 05 2019 02:14:51

%S 1,2,3,4,5,12,34,51,23,45,123,451,234,512,345,1234,5123,4512,3451,

%T 2345,12345,123451,23451,234512,34512,345123,45123,451234,51234,

%U 512345,1234512,3451234,5123451,2345123,4512345,12345123,45123451,23451234,51234512

%N a(n) is the smallest number not already in the sequence, such that the concatenation of all a(n) displays the periodic digit string 1, 2, 3, 4, 5 (and repeat).

%e Starting from 1, 2, 3, 4, 5, the next number must be 12 because we need to continue with a 1. But 1 is already in the sequence so we need to attach a 2 -> 12. And so on.

%p cyc5 := proc(n) op(n,[2,3,4,5,1]) ; end:

%p A165303 := proc(n) option remember ; local k,prev,d,a ; if n = 1 then 1; else d := cyc5(procname(n-1) mod 10) ; a := d ; while true do prev := false; for k from 1 to n-1 do if procname(k) = a then prev := true; break; end if; end do; if not prev then return a; end if; d := cyc5(d) ; a := 10*a+d ; end do; end if ; end proc:

%p seq(A165303(n),n=1..60) ; # _R. J. Mathar_, Oct 16 2009

%Y Cf. A165300-A165302, A165304-A165307.

%K easy,base,nonn

%O 1,2

%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Sep 14 2009

%E Keyword:base added, sequence extended by _R. J. Mathar_, Oct 16 2009