cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A097962 Slowest increasing sequence where the digits, taken one by one, show the pattern even/odd/even/odd/even...

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 23, 25, 27, 29, 41, 43, 45, 47, 49, 61, 63, 65, 67, 69, 81, 83, 85, 87, 89, 210, 301, 410, 501, 610, 701, 810, 901, 2101, 2103, 2105, 2107, 2109, 2121, 2123, 2125, 2127, 2129, 2141, 2143, 2145, 2147, 2149, 2161, 2163, 2165, 2167, 2169
Offset: 0

Views

Author

Eric Angelini, Sep 06 2004

Keywords

Comments

Distinct from A098951, which is not required to be increasing. The first 31 terms are identical, but here a(30) = 210 must be followed by a(31) = 301, while there 210 is followed by 10. - M. F. Hasler, Mar 23 2019

Programs

  • Mathematica
    nn = 57; c[_] := False; a[0] = j = 0; p = 1; c[0] = True;
    Do[k = j;
      While[(Set[q, Mod[#[[-1]], 2]];
        Nand[! c[k], Mod[#[[1]], 2] == p,
        Union[Length /@ SplitBy[#, EvenQ]] == {1}]) &[IntegerDigits[k]],
        k++]; Set[{a[n], j, p, c[k]}, {k, k, 1 - q, True}], {n, nn}];
    Array[a, nn + 1, 0] (* Michael De Vlieger, Dec 09 2024 *)
  • PARI
    nxt(n,d=digits(n))={if(!bittest(#d,0), forstep(i=#d,1,-1, 10>(d[i]+=2)&& return(fromdigits(d)); d[i]-=10);  d||return(1); d[#d]=if(d[1]%=2,10,21); fromdigits(Vecrev(d)), 10>d[1]+=1, d[1]=d[1]*10+d[#d]; fromdigits(d)\10, d[1]=21; fromdigits(d))}
    vector(50,i,t=if(i>1,nxt(t),0)) \\ M. F. Hasler, Mar 23 2019

A307129 Lexicographically earliest sequence of distinct terms such that the sequence of digits has alternating parity, and the same holds for the digits of the sequence a(n) + a(n+1).

Original entry on oeis.org

1, 29, 21, 49, 23, 27, 25, 45, 47, 43, 258, 12, 18, 14, 16, 34, 36, 38, 32, 58, 123, 87, 214, 56, 125, 85, 216, 54, 127, 83, 218, 52, 129, 81, 2929, 89, 212, 78, 1014, 76, 1016, 74, 1018, 72, 1218, 1812, 1238, 1814, 1216, 1816, 1214, 1818, 1212, 1838, 1232, 1858, 1234, 1836, 1236, 1834, 1256, 3814, 1258, 1832, 1418, 1612, 1438, 1614, 1416, 1616, 1414, 1618, 1412, 1638, 1432, 1658, 1434, 1636, 1436, 1634, 1456, 3614, 1458, 1632, 3418, 1652, 3438, 1654, 3416, 1656, 3414, 1676, 3616, 1454, 3618, 1452, 3638, 1852, 3218, 1854
Offset: 1

Views

Author

Eric Angelini and Lars Blomberg, Mar 26 2019

Keywords

Comments

In the sequel we use S(n) = a(n) and T(n) = a(n) + a(n+1).
T is the sequence of the "first sums" of the successive pairs of S's adjacent terms. S(1) + S(2) = 1 + 29 = 30 and thus T(1) = 30; S(2) + S(3) = 29 + 21 = 50 and thus T(2) = 50; S(3) + S(4) = 21 + 49 = 70 and thus T(3) = 70; etc.
T has an entry for itself in the OEIS (A307130).
S and T need a lot of backtracking to be computed; this means that the last few terms of S and T might evolve. However, the first 100 terms proposed here seem correct.
It appears that the sequence can be computed in a greedy way, by discarding only the last term when it's impossible to find a successor for it. It also appears that the lexicographic earliest sequence following the same rules but starting with a(1) = 0 (or with a(1) = 2) is given, after this initial term, by the terms following S(11) = 258, i.e., a(2) = S(12) = 12, a(3) = S(13) = 18, etc. - M. F. Hasler, Apr 08 2019

Examples

			The first terms of S are 1, 29, 21, 49, 23, 27, 25, 45, 47, 43, 258, ... and we see that the digits of S follow the pattern odd/even/odd/even...
The first terms of T are 30, 50, 70, 72, 50, 52, 70, 92, 90, 301, ... and we see that the digits of T follow the same odd/even/odd/even... pattern.
		

Crossrefs

Cf. A307130 which is the associated sequence T.
See also: A097962, A098951.

Programs

  • PARI
    okapi(N,a=1,U=[])={local(good(t)=if( t>T*98\99, T*=10; T*10\99+(t<11)*11, for(p=1,oo, t+=10^p; t\10^p%10>1 && return(t); t>=T&&break); (t+2*T*=10)\10),T, S,Sb,b=-1); while( N>#U=setunion(U,[a]), b!=a&& print1(a","); my(t=1-a%2); T=10; while((t+=2)%10>1 ||99*a+99>t=good(t), if( !setsearch(U,t) && setsearch([[1],[2]], Set(digits(fromdigits(concat(S, digits(a+t)%2),2),4))), Sb=S; S=2-(a+t)%2; b=a; a=t; next(2))); print1("no: "); S=Sb; a=b; N++);a} \\ 2nd & 3rd (optional) arg allow to specify the initial value and forbid specific values. - M. F. Hasler, Apr 08 2019

Extensions

Edited by M. F. Hasler, Apr 08 2019

A377919 a(0) = 0; thereafter a(n) is the lexicographically earliest missing nonnegative integer such that the digits in the sequence (ignoring the commas) alternate in parity.

Original entry on oeis.org

0, 1, 2, 10, 101, 21, 210, 1010, 10101, 2101, 21010, 101010, 1010101, 210101, 2101010, 10101010, 101010101, 21010101, 210101010, 1010101010, 10101010101, 2101010101, 21010101010, 101010101010, 1010101010101, 210101010101, 2101010101010, 10101010101010, 101010101010101, 21010101010101, 210101010101010, 1010101010101010, 10101010101010101, 2101010101010101, 21010101010101010, 101010101010101010
Offset: 0

Views

Author

N. J. A. Sloane, Dec 08 2024

Keywords

Comments

A "lexicographically earliest" variant of A098951.

Examples

			We begin by arranging the nonnegative integers whose digits alternate in parity in lexicographic order. First, 0; then the numbers with first digit 1: 1, 10, 101, 1010, 10101, 101010, ...; then the numbers with first digit 2: 2, 20, 201, 2010, 20101, 201010, ...; then the numbers with first digit 3, and so on.
The sequence begins with 0 and from then on we choose the first unused number from the above list which preserves alternating parity of the digits in the sequence.
(The above list does not have an OEIS entry, since there are uncountably many terms before the number 2 appears. In fact there are uncountably many terms before 12 appears. The beginning of the list coincides with A056830.)
		

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{1, -1, 1, 100, -100, 100, -100}, {0, 1, 2, 10, 101, 21, 210, 1010, 10101}, 50] (* Paolo Xausa, Dec 09 2024 *)

Formula

a(0) - a(6) are 0, 1, 2, 10, 101, 21, 210. Thereafter, for k >= 2,
a(4*k-1) = a(4*k-5) || 10,
a(4*k) = a(4*k-4) || 01,
a(4*k+1) = a(4*k-3) || 01,
a(4*k+2) = a(4*k-2) || 10,
where || denotes concatenation.
Showing 1-3 of 3 results.