login

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

Lexicographically earliest sequence with a(n) odd digits among the first a(n+1) decimal digits, for any n; a(1) = 1, a(2) = 2.
2

%I #36 Dec 21 2024 18:32:13

%S 1,2,3,5,8,11,21,31,41,51,62,80,201,331,511,711,911,1111,1311,1511,

%T 1711,1911,2111,3111,4111,5111,6111,7200,8289,9378,10467,11556,12645,

%U 13734,14823,20000,26000,40000,60000,80000,200000,400000,600000,800000

%N Lexicographically earliest sequence with a(n) odd digits among the first a(n+1) decimal digits, for any n; a(1) = 1, a(2) = 2.

%C Without the requirement a(2) = 2 (or: increasing, or: without repeated terms), the trivial sequence (1, 1, 1, ...) = A000012 would also satisfy the definition, repeatedly stating that the first digit is odd, ignoring all other digits. But a(2) - a(1) > 0 implies that the sequence will be strictly increasing throughout, and therefore make infinitely many nontrivial statements concerning all of its digits.

%C The formula comes from the fact that if we have a(n-1) odd digits among the first a(n) digits, and we need a(n) odd digits among the first a(n+1) digits, then we must use exactly a(n) - a(n-1) odd digits after the a(n)-th digit up to and including the a(n+1)-th digit, whence a(n+1) >= a(n) + a(n) - a(n-1).

%H Eric Angelini, <a href="https://cinquantesignes.blogspot.com/2020/05/a-proportion-odd-digits-vs-all-digits.html">A proportion (odd digits vs all digits)</a>, personal blog "Cinquante signes" on blogspot.com, May 14 2020.

%H Eric Angelini, <a href="/A332070/a332070.pdf">A proportion (odd digits vs all digits)</a>, personal blog "Cinquante signes" on blogspot.com, May 14 2020. [Cached copy]

%F a(n+1) >= 2*a(n) - a(n-1) for n > 1.

%e There is a(1) = 1 odd digit, namely: '1', among the first a(2) = 2 digits which are '1' and '2'.

%e There are 2 odd digits ('1' and '3') among the first a(3) = 3 digits, '1', '2' and '3'.

%e Then there must be a(3) = 3 odd digits among the first a(4) digits. Since there are only 2 odd digits coming earlier, there must come at least 1 more odd digits. This excludes a(4) = 4, but makes the next smaller choice a(4) = 5 possible, provided it will be followed by an even digit in order to satisfy the requirement that there be exactly 3 odd digits among the first 5 digits.

%e Knowing that the first digit of a(5) must be even (see just above), and that a(5) >= 2 a(4) - a(3) = 7 (see formula, explained in comments), we have as smallest possibility a(5) = 8, which does not raise a contradiction.

%e Then again we can use a(6) = 2*8-5 = 11, least possibility according to the formula, and indeed not yet leading to a contradiction. However, these are digits number 6 and 7 of the sequence, both odd, and the previous two terms state that there must be 5 odd digits among the first 8 digits, so the next digit must be even.

%e According to the above, a(7) >= 20, the least integer > 2*11 - 8 starting with an even digit. It would be the 8th and 9th digit of the sequence. But we need a(5) = 8 odd digits among the first a(6) = 11 digits. If we use two even digits here, we can't reach the required 11 odd digits with the 5 odd digits up to a(8), the two '1's in position 6 & 7, and two more odd digits in position 10 & 11. This is only possible if the 9th digit is odd, too. So the smallest possibility is a(7) = 21.

%e And so on.

%o (PARI) upto(N)={my( a=Vec([1,2],N), o=[1,1], s=1, m=1); for( n=3,N, a[n]=2*a[n-1]-a[n-2]; while( m <= n && a[m] <= #o, m++); until( !a[n]++, my(ns=s, no=concat( o,[ ns+=d | d<-digits(a[n])%2 ])); for( i=m,n, a[i] <= #no && next(( a[i-1] != no[a[i]] )+1); no[#no] > a[i-1] && next(2); no[#no] + a[i] - #no >= a[i-1] || next(2)); o=no; s=ns; break)); a}

%Y Cf. A332071 (variant based on the numbers rather than their digits).

%K nonn,base

%O 1,2

%A _M. F. Hasler_ and _Eric Angelini_, May 18 2020