MyQuotient[n_Integer, list_List ] :=
  Quotient[n, First[list]] + 1 /; Length[list] == 1

MyQuotient[n_Integer, list_List] :=
Block[ { s = First[list], q = 1 },
  While[n > s, q++; s += list[[q]]]; q] /; Length[list] > 1

MyMod[n_Integer, list_List ] :=
  Mod[n, First[list]] /; Length[list] == 1

MyMod[n_Integer, list_List ] :=
  n - Fold[Plus, 0, Take[list, MyQuotient[n,list]-1]] /; Length[list] > 1

MyDigitsInit [ n_, {}, _] := {n}
MyDigitsInit[n_, list_List, path_ ] :=
Block[ {r = MyQuotient[n,First[list][path]]},
Prepend[MyDigits[MyMod[n,First[list] [path]],
Rest[list], Append[path,r]],
MyQuotient[n, First[list][path]]]]

MyDigits[n_, list_List, path_] :=
Block[{md = MyDigitsInit[n, list, path]},
If[Last[md] ≠ 0,
md,
MapAt[# + 1&,
MyDigitsInit[n-1,list,path],
{-1}]
]]

MyDigits[n_, b_List] := {n} /; b == {} || 0 < n < Last[b]

MyDigits[n_, b_List] :=
Append[MyDigits[Quotient[n,Last[b]], Drop[b,-1]],
Mod[n,Last[b]]]

DigitsToNumber[ date_, list_, path_ ] :=
1 + date[[1]] list[[1]][path+1][[1]] + Last[date] +
( Plus @@
( Fold[Plus, 0, Take[list[[#]][path+1], date[[#]]]]& /@
  Range[2, Length[list]]))

DigitsToNumber[{n_}, b_]:= n

DigitsToNumber[digits_List, b_] :=
DigitsToNumber[Drop[digits,-1],
Drop[b,-1]] Last[b] + Last[digits]

DigitsToNumber[{438,4,9,3},JulianCalendar,{ 438, 4, 9, 3} ]

JulianCalendar = { JulianFourYears, JulianYears, JulianMonths }

JulianFourYears[_] := { 1461 }

JulianYears[_] := { 365, 365, 365, 366 }

JulianMonths[path_List] := 
{ 31, 28+Quotient[path[[2]],4], 
31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }

NumberToDate [ n_, Julian ] :=
  Prepend [ Drop[#,2],
    DigitsToNumber[Take[#-1,2], {4}] + 1]& @
    MyDigits[n, JulianCalendar, {} ]

NumberToDate[639799,Julian]

DateToNumber [ date_, Julian] :=
Block [ { d = Join[MyDigits[First[date]-1, {4}],
  Rest[date]-1]},
  d = Join[Table[0, {4-Length[d]}], d];
  DigitsToNumber[d, JulianCalendar, d ]]

DateToNumber [ {1752,9,3}, Julian ]