chinesevilla.blogg.se

Babylonian numerals 83
Babylonian numerals 83











babylonian numerals 83

Textual evidence alerts us to the presence of parrots, peacocks, and wild jungle fowl at the Iranian court as well as the probability that the Achaemenid Persians were familiar with rhinoceroses, tigers, and even okapi. Amidst the gold, silver, textiles and precious stones brought to the ruler is a rich abundance of exotic wildlife: Asiatic lions, Bactrian camels, zebu, wild asses, and Arabian horses. Commanding lands from India to Ethiopia and Libya to Afghanistan, the Great Kings of Persia demanded loyalty and tribute from the conquered peoples who made up their vast realm, and the walls of their ceremonial capital at Persepolis in the heart of Iran abound with images of foreign delegations carrying tribute to their monarch. Using Seq.mapi it can be done like this for 139 bytes: let f(v:string)=v.Split ' '|>Seq.rev|>Seq.mapi(fun i r->Seq.sumBy(fun c->match c with|'10.0|'T'->1.0|_->0.0)r*(60.0**float i))|>Seq.The Achaemenid dynasty (559–331 B.C.) ruled the biggest empire the ancient world had ever seen. The entire function will return a float, which (in my opinion) is a little messy. From there you could do 60 ** index (where ** is the power operator in F#).īut ** requires floats, not ints, which means that you need to either initialise or cast all the values in the function as float. Seq.mapi maps each element in the sequence, and provides the index to the mapping function. The fst function returns the first item in that tuple, and Seq.sum does the actual summing. The function will return a tuple of seq, int. The initial state for the accumulator is 1.įor example, the order of calls and results in Seq.mapFoldBack for input (4, 60) i is then multiplied by 60, and this value is then passed to the next item in the sequence. Seq.mapFoldBack iterates through the sequence backwards, and threads an accumulator value through the sequence (in this case, i).įor each element in the sequence, the Babylonian number is computed (by Seq.sumBy, which maps each character to a number and totals the result) and then multiplied by i. Seq.mapFoldBack combines Seq.map and Seq.foldBack. Ungolfed it would look like this: let s (v:string) =

• The i*Seq.sumBy(fun c->match c with|'10|'T'->1|_->0)r,i*60)(v.Split ' ')1|>fst|>Seq.sum

The inputted number will always be under \$10^7\$.

#BABYLONIAN NUMERALS 83 FREE#

  • You are free to accept either ASCII input ( T<\) or Unicode input ( 𒐕𒌋𒑊).
  • You then add up the value of each to get the value of the number.Ĭolumns will be separated by spaces to prevent ambiguity. This works exactly the same as any other base sixty, where you multiply the value of the rightmost column by \$60^0\$, the one to the left by \$60^1\$, the one to the left by \$60^2\$ and so on. Now, we need to extend this to adding more columns. \ will always appear alone in the column. There will never be more than five < or more than nine T in each column. So, in each column you just add up the value of the symbols, e.g.: <<< = 30

    babylonian numerals 83

    However, for the purposes of this challenge, it's enough to consider \ as zero 'Zero' was invented later, so \ was a placeholder symbol added later to prevent ambiguity. Note: Technically, \ (or 𒑊) isn't zero (because the Babylonians did not have a notion of 'zero'). The Babylonians had only three symbols: T (or, if you can render it: 𒐕) which represented 1, and < (or, if you can render it: 𒌋) which represented 10, and \ (or, if you render it: 𒑊) which represented zero. Let's first consider the unit column of the system:

    babylonian numerals 83

    How did the Babylonians count? Interestingly, they used a Base 60 system with an element of a Base 10 system. Given an ASCII representation of a Babylonian number as input, output the number in Western Arabic numerals.













    Babylonian numerals 83