A solution to last week's challenge can be found here.
This week's challenge was submitted by @patrick_digan - Thanks for your submission!
It was inspired by this post where a user was trying to get the Mod function (Modulo) to work for big numbers.
For this challenge, you will have to create a macro to divide big numbers.
So let’s try to divide 1,234,567,890,109,876,543,210 by 1,234 and produce both the quotient and remainder.
Scratching your head already?!
Hint: It's not 1,000,460,202,682,230,000 with remainder -442
Not sure how others will solve this with the limitations of the Mod function to Int64 within Alteryx, but I would just go with Python. So here is my one tool Python solution!
from ayx import Package from ayx import Alteryx import pandas as pd data = Alteryx.read("#1") a = int(data['Field1'].iloc) b = int(data['Field2'].iloc) df = pd.DataFrame(divmod(a,b)).T df.columns = ['answer','remainder'] result = pd.concat([data,df], axis=1,join='inner') Alteryx.write(result,1)
I feel I should get some credit for this one, since I actually provided solution to the original post. 😁
This is a rather mathmatical solution, I believe.
A clumsy but original solution. Thanks for the challenge!
@Qiu your solution is so elegant! Way to go.