I stumbled upon this question:
7 power 7 is 823543. Which higher power of 7 ends with 823543 ?
How should I go about it ? The one I came up with is very slow, it keeps on multiplying by 7 and checks last 6 digits of the result for a match.
I tried with Lou's code:
int x=1;
for (int i=3;i<=100000000;i=i+4){
x=(x*7)%1000000;
System.out.println("i="+ i+" x= "+x);
if (x==823543){
System.out.println("Ans "+i);}
}
And CPU sounds like a pressure cooker but couldn't get the answer :(
The term “number crunching” describes the act of processing numerical data. It generally refers to taking large amounts of related numerical data and organizing it into a more useful format. That organizing often includes running calculations and arranging data in charts, graphs and other visualizations.
number cruncher | Business Englishsomeone whose job involves working with numbers and doing calculations: The City's number crunchers estimated that the high-street retailer grew by only 0.5% in the last quarter.
Multiply modulo 10^6. See this Lua code.
local x=1
for i=1,100000 do
x=(x*7) % 1e6
if x==823543 then print(i) end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With