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-4 of 4 results.

A098951 Smallest available integer fitting the even/odd/even/odd/even... digit pattern (across adjacent numbers).

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, 10, 12, 14, 16, 18, 30, 32, 34, 36, 38, 50, 52, 54, 56, 58, 70, 72, 74, 76, 78, 90, 92, 94, 96, 98, 101, 212, 103, 214, 105, 216, 107, 218, 109
Offset: 1

Views

Author

Eric Angelini, Oct 21 2004

Keywords

Comments

Different from A097962.
Indeed, A097962 is required to be increasing. Therefore, a(31) = 210 can here be followed by a(32) = 10, while A097962(32) = 301. - M. F. Hasler, Mar 23 2019

Examples

			After a(30) = 89, a(31) must start with an even digit. A number consisting of one even digit would work, but they are all in the sequence already. A 2-digit number with first digit even and second digit odd would work, but they are also all in the sequence already. A 3-digit number would have to have even, odd, and even digits in that order. The smallest such number is 210, so a(31) = 210. - _Michael B. Porter_, Mar 25 2019
		

Crossrefs

See also A377919.

Programs

  • Mathematica
    altQ[n_] := n < 10 || Union[Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; s = {0}; Do[j=1; While[ MemberQ[s, j] || EvenQ[s[[-1]] + First@ IntegerDigits@ j] || ! altQ[j], j++];  AppendTo[s, j], {68}]; s (* Giovanni Resta, Mar 05 2014 *)
    (* longer, but faster *) eoQ[n_] := Module[{d = IntegerDigits[n], alt, i}, alt = Table[If[OddQ[i], -1, 1], {i, d}]; i = 1; While[i++; i <= Length[d] && alt[[i]] == alt[[1]]*(-1)^(i + 1)]; If[i <= Length[d], alt[[1]] = 0]; alt[[1]]]; nn = 10000; tev = {}; tod = {}; Do[If[eoQ[i] == -1, AppendTo[tod, i], If[eoQ[i] == 1, AppendTo[tev, i]]], {i, nn}]; t = {0}; While[tev != {} && tod != {}, If[OddQ[t[[-1]]], AppendTo[t, tev[[1]]]; tev = Rest[tev], AppendTo[t, tod[[1]]]; tod = Rest[tod]]]; t (* T. D. Noe, Mar 05 2014 *)

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

A097484 Write the odd positive integers on labels in numerical order, forming an infinite sequence L. Consider the succession of single digits of L: 1 3 5 7 9 1 1 1 3 1 5 1 7 1 9 2 1 2 3 2 5 2 7 2 9 3 1 ... (A031312). This sequence is a derangement of L that produces the same succession of digits, subject to the constraint that the smallest unused label must be used that does not lead to a contradiction.

Original entry on oeis.org

13, 5, 7, 9, 1, 113, 15, 17, 19, 21, 23, 25, 27, 29, 3, 133, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 11, 1113, 115, 117, 119, 121, 123, 125, 127, 129, 131
Offset: 1

Views

Author

Eric Angelini, Sep 19 2004

Keywords

Comments

Derangement here means the n-th element of L is not the n-th element of this sequence, so a(n) != 2n - 1.

Examples

			We must begin with 1,3,5,7... and we cannot have a(1) = 1, so the next possibility is the label "13". The next term must be the smallest available label not leading to a contradiction, thus "5". The next one will be "7", etc. After the label "9" the smallest available label is "1". After this "1" we cannot have a(6) = 11 -- we thus take the smallest available label which is "113". No label is allowed to start with a leading zero.
		

Crossrefs

Same type of sequence -- but for even numbers -- is A097481. - Eric Angelini, Aug 12 2008

Extensions

Corrected and extended by Jacques ALARDET and Eric Angelini, Aug 12 2008
Derangement wording introduced by Danny Rorabaugh, Nov 26 2015

A102093 Slowest increasing sequence where the digits, taken one by one, show the pattern odd/odd/even/even/odd/odd/even/even... Only the terms < 300 differ from A098161.

Original entry on oeis.org

1, 3, 4, 6, 7, 9, 20, 31, 40, 51, 60, 71, 80, 91, 201, 300, 310, 411, 421, 500, 510, 611, 621, 700, 710, 811, 821, 900, 910, 2110, 2112, 2114, 2116, 2118, 2130, 2132, 2134, 2136, 2138, 2150, 2152, 2154, 2156, 2158, 2170, 2172, 2174, 2176, 2178, 2190
Offset: 1

Views

Author

Eric Angelini, Feb 13 2005

Keywords

Crossrefs

Showing 1-4 of 4 results.