login
Partition numbers (A000041) in which parity of digits alternates.
0

%I #12 Jan 05 2018 02:59:58

%S 1,2,3,5,7,30,56,101,385,490,3010,4565,8349,10143

%N Partition numbers (A000041) in which parity of digits alternates.

%C No more terms up to numbpart(7000).

%C Intersection of A000041 and A030141.

%e 8349 is in the sequence because 8, 3, 4 and 9 have even and odd parity alternately.

%o (PARI)

%o is_alt(n) = m=n; e=n%10; n\=10; while(n>0, f=n%10; if(e%2==f%2, return, e=f; n\=10)); return(m)

%o select(is_alt, vector(7000, n, numbpart(n)))

%o (Python)

%o from sympy import npartitions

%o A297710_list = []

%o for i in range(1,10**6):

%o n = npartitions(i)

%o s = [int(d) for d in str(n)]

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

%o if not (s[j]+s[j+1]) % 2:

%o break

%o else:

%o A297710_list.append(n) # _Chai Wah Wu_, Jan 04 2018

%Y Cf. A000041, A030141.

%K nonn,base,more

%O 1,2

%A _Colin Barker_, Jan 04 2018