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

A233574 a(n) is the smallest term of either A233010 or A233572 such that |n-a(n)|

Original entry on oeis.org

0, 1, 2, 2, 4, 3, 4, 6, 8, 6, 6, 8, 8, 7, 12, 8, 10, 9, 10, 13, 12, 13, 16, 20, 16, 18, 26, 18, 18, 20, 18, 18, 20, 20, 18, 26, 20, 24, 26, 21, 24, 21, 26, 43, 32, 24, 28, 26, 28, 43, 30, 27, 28, 27, 28, 54, 30, 39, 40, 32, 32, 43, 32, 39, 40, 39, 40, 43, 36
Offset: 0

Views

Author

Lei Zhou, Dec 13 2013

Keywords

Comments

It is conjectured that a(n) exists for all n >= 0.

Examples

			a(19)=13 since 19=13+6=A233010(9)+A233572(3) and 13>6. There is no number in A233010 or A233572 smaller than 13 that satisfies the same condition.
		

Crossrefs

Programs

  • Mathematica
    BTDigits[m_Integer, g_] :=
    (*This is to determine digits of a number in balanced ternary notation.*)
    Module[{n = m, d, sign, t = g},
      If[n != 0, If[n > 0, sign = 1, sign = -1; n = -n];
       d = Ceiling[Log[3, n]]; If[3^d - n <= ((3^d - 1)/2), d++];
       While[Length[t] < d, PrependTo[t, 0]];
       t[[Length[t] + 1 - d]] = sign;
       t = BTDigits[sign*(n - 3^(d - 1)), t]]; t];
    BTpaleQ[n_Integer] :=
    (*This is to query if a number is an element of sequence A233010.*)
    Module[{t, trim = n/3^IntegerExponent[n, 3]},
      t = BTDigits[trim, {0}]; t == Reverse[t]];
    BTrteQ[n_Integer] :=
    (*This is to query if a number is an element of sequence A233572.*)
    Module[{t, trim = n/3^IntegerExponent[n, 3]},
      t = BTDigits[trim, {0}]; DeleteDuplicates[t + Reverse[t]] == {0}];
    sa = Select[Range[0, 30000], BTpaleQ[#] &];
    (*This is to generate a limited list of A233010.*)
    sb = Select[Range[0, 30000], BTrteQ[#] &];
    (*This is to generate a limited list of A233572.*)
    range = 68; Table[i1 = 0; i2 = 0;
    While[If[sa[[i1 + 1]] < sb[[i2 + 1]], i1++; nh = sa[[i1]]; isa = 1,
       i2++; nh = sb[[i2]]; isa = 0]; (2*nh) < n];
    While[If[isa == 0, chk = MemberQ[sa, Abs[n - nh]],
       chk = MemberQ[sb, Abs[n - nh]]]; ! chk,
      If[sa[[i1 + 1]] < sb[[i2 + 1]], i1++; nh = sa[[i1]]; isa = 1, i2++;
       nh = sb[[i2]]; isa = 0]];
    If[isa == 0, m = sb[[i2]], m = sa[[i1]]]; m, {n, 0, range}]
Showing 1-1 of 1 results.