Post date: Jan 13, 2019 3:26:55 PM
"Given a CSV file containing calculations of the form row[0]**row[1], find the row with the highest calculated value. Warning: The results have over 3 million digits."
When solving equations with exponents, you can take the log of both sides. And a log of an exponent is equal to the exponent times the log of the base. In other words,
b ** e = u ** s
log (b ** e) = log (u ** s)
e * log (b) = s * log (u)
This can be used in comparison as well. The numbers will be nice small floats, not giant integers, so this is good for SQL.
create table #Exponents (b int, e int)
bulk insert #Exponents from 'E:\base_exp.txt' with
(rowterminator = '0x0a', fieldterminator = ',')
alter table #Exponents add rn int not null identity(1,1)
select top rn from #Exponents
order by e * log(b) desc