login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(1) = 1, a(n+1) is the smallest odd multiple of a(n) (other than a(n) itself) in which the digits are alternately even and odd.
4

%I #18 Nov 11 2024 22:27:50

%S 1,3,9,27,81,567,8505,76545,9874305,6763898925,41672381276925,

%T 25432529276163496725,6947294789656341278149816125,

%U 2341412581496361870123890149638785410125

%N a(1) = 1, a(n+1) is the smallest odd multiple of a(n) (other than a(n) itself) in which the digits are alternately even and odd.

%e a(6) = 567 = 7*a(5); the digits alternate odd, even, odd.

%p isA030141 := proc(n) local dgs,i ; dgs := convert(n,base,10) ; for i from 1 to nops(dgs)-1 do if ( op(i,dgs)+op(i+1,dgs)) mod 2 = 0 then RETURN(false) ; fi ; od ; RETURN(true) ; end: A078226 := proc(nmax) local a,f; a := [1] ; while nops(a) < nmax do f := 3 ; while true do if isA030141(f*op(-1,a)) then a := [op(a),f*op(-1,a)] ; print(op(-1,a)) ; break ; fi ; f := f+2 ; od ; od ; end: A078226(13) ; # _R. J. Mathar_, Mar 01 2007

%o (Python)

%o A078226_list = [1]

%o for _ in range(20):

%o x = A078226_list[-1]

%o y, x2 = x, 2*x

%o while True:

%o y += x2

%o s = str(y)

%o for j in range(len(s)-1, -1, -2):

%o if not s[j] in ('1', '3', '5', '7', '9'):

%o break

%o else:

%o for k in range(len(s)-2, -1, -2):

%o if not s[k] in ('0', '2', '4', '6', '8'):

%o break

%o else:

%o A078226_list.append(y)

%o break

%o # _Chai Wah Wu_, Nov 06 2014

%Y Cf. A078221, A078222, A078223, A078224, A078225, A078227.

%K base,nonn

%O 1,2

%A _Amarnath Murthy_, Nov 23 2002

%E More terms from _Sascha Kurz_, Jan 30 2003

%E a(12) from _R. J. Mathar_, Mar 01 2007

%E a(13), a(14) from _Max Alekseyev_, May 12 2010