OFFSET
2,2
FORMULA
a(n) = CodeContinuedfraction[Palindromic number[n]]
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}]
CROSSREFS
KEYWORD
nonn,uned,base
AUTHOR
Roger L. Bagula, Dec 07 2003
STATUS
approved