login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Alternately concatenate the decimal digits from front to back 1...n such that n is always to the right.
2

%I #11 Jan 29 2017 11:10:39

%S 1,12,213,3124,42135,531246,6421357,75312468,864213579,97531246810,

%T 1086421357911,119753124681012,12108642135791113,1311975312468101214,

%U 141210864213579111315,15131197531246810121416,1614121086421357911131517

%N Alternately concatenate the decimal digits from front to back 1...n such that n is always to the right.

%C a(n) is prime for n: 121, 1399 and no others < 3000.

%H Indranil Ghosh, <a href="/A281253/b281253.txt">Table of n, a(n) for n = 1..340</a>

%e a(13) = 12108642135791113.

%p b:= proc(n) b(n):= `if`(n=1, 1, parse(cat(n, a(n-1)))) end:

%p a:= proc(n) a(n):= `if`(n=1, 1, parse(cat(b(n-1), n))) end:

%p seq(a(n), n=1..20); # _Alois P. Heinz_, Jan 18 2017

%t f[n_] := Fold[ If[ Mod[n +#2, 2] == 0, #1, #2]*10^IntegerLength@ If[ Mod[n +#2, 2] == 0, #2, #1] +If[ Mod[n +#2, 2] == 0, #2, #1] &, 0, Range@ n]; Array[f, 17]

%o (Python)

%o def a(n):

%o ....if n==1:

%o ........return ["1"]

%o ....return a(n-1)[::-1]+[str(n)]

%o def A281253(n):

%o ....return "".join(a(n)) # _Indranil Ghosh_, Jan 27 2017

%Y Cf. A007908, A138957, A000422, A138793, A281254.

%K nonn,base,easy

%O 1,2

%A _Robert G. Wilson v_, Jan 18 2017