A089184 A coding semi-palindromic sequence made by converting a zero containing limited digit set palindromic sequence to a fraction and then converting back to an continued fraction array and making the sequence up from the result.
1, 22, 111, 4444, 33333, 333333, 3333333, 13333133, 133331133, 3323333233, 31133331133, 333343333433, 3333333333333, 33333333333333, 333333333333333, 3313333333313333, 31133333333113333, 333323333333323333
Offset: 2
Crossrefs
Cf. A007907.
Programs
-
Mathematica
Clear [a, b, c, d, e, f, g, m] (* these continued fraction functions are given in the Mathematica documentation*) CF[r0_?NumericQ, n_Integer?NonNegative] := Module[{l = {}, r = r0, a}, Do[ a = Floor[r]; (* integer part *) AppendTo[l, a]; r = r - a; (* fractional part; 0 <= r < 1 *) If[ r == 0, Break[] ]; r = 1/r; (* r > 1 *), {n}]; l ] CFValue[l_List] := Fold[ 1/#1 + #2&, Infinity, Reverse[l] ] digits=50 c[1]=1 c[2]=0 c[3]=2 c[0]=3 (* general Palindromic continued fraction generator for length m-1*) a[m_]=Delete[Table[If [ Floor[m/2]-n>=0, c[ Mod[n, 4]], c[Mod[m-n, 4]]], {n, 1, m}], m] (* make the fraction from the palindromic array*) e=Table[CFValue[Flatten[Table[a[m], {k, 1, digits}]]], {m, 2, digits}]; (* get the new semi- Palindromic continued fraction array with zeros eliminated*) f[n_]=CF[e[[n]], digits]; (* create new semi-palindromic sequence from the continued fraction array*) g=Table[Sum[f[m][[i]]*10^(i-1), {i, 1, m-1}], {m, 2, digits-1}]
Formula
a(n) = CodeContinuedfraction[Palindromic number[n]]