The Powers That Be
-
- Posts: 17
- Joined: Thu Apr 21, 2011 3:08 am
Calculation Was Easy
I did the calculations on a bignum calc in C++ that I had made long ago. I actually had added the option to display every xth digit. I just made a slight edit so that now I can choose what digit to start off of.
First thing I've written in 5 years, and first time ever using ruby. I could clean this up, but this is what I did to solve:
Of course, it pops a new number out each line. I know how to clean it now, but hey, its okay for a first run.
Code: Select all
y = ((17**39)**11)
y = y.to_s
z = 0
x = y[z].chr
while x != nil do
puts x
z = z + 33
x = y[z].chr
end
Hi all,
this is my solution in C# (.NET 4)
Greets from Dresden
Seplik
this is my solution in C# (.NET 4)
Code: Select all
using System;
using System.Numerics;
namespace ThePowerToBe
{
class Program
{
static void Main(string[] args)
{
BigInteger ergebnis = BigInteger.Pow(17, 39 * 11);
string tmp = ergebnis.ToString();
for (int i = 0; i < tmp.Length; i++)
{
if (i % 33 == 0)
{
Console.Write(tmp[i].ToString());
}
}
Console.ReadLine();
}
}
}
Seplik
-
- Posts: 5
- Joined: Sun Mar 11, 2012 2:57 pm
- Contact:
I calculate all digits with wolframalpha.com and copy it in this JS code:
Code: Select all
var str="7287646047175693809181003658560624690001934249475037583383410966869968575
4467436227234724042627102964298841820516037233528475978459785414759364887185809727
4405592779889038847476635050174799866232012301434410796898542809249563904637123246
8838883439670635548482463420202788891164816364632521828315194205599067991807910869
8595734119712778333056577256424265140391245645531793341906275133082870098777864521
4725045780084668671936673752128478286140806951581228924388701768931419905595306419
093162717560756925359266275186144493274175697";
for (i=0;i<str.length;i+=33)
{
document.write(str.charAt(i));
}
lol?hobbist wrote:Gawd, I love python. Can't wait until I really start learning.Code: Select all
x = str(((17**39)**11)) x2 = '' for i in range(0,len(x),33): x2 += x[i] print 'powers that be ', x2
print str((17**39)**11)[::33]
-
- Posts: 22
- Joined: Wed Apr 13, 2011 12:00 am
- Location: Vila Velha
- Contact:
Java is easy enough
For the Math
And to concatenate each 33rd
Code: Select all
public BigInteger ThePowersThatBe(){
BigInteger n17 = new BigInteger("17");
return n17.pow(39).pow(11);
}
And to concatenate each 33rd
Code: Select all
public String ThePowersThatBe(BigInteger result){
String retorno = "";
int pivot = 0;
while (true){
try{
retorno += result.toString().substring(pivot, pivot+1);
pivot+=33;
}catch (StringIndexOutOfBoundsException e) {
return retorno;
}
}
}
sudo apt-get a life
-
- Posts: 4
- Joined: Tue Jul 12, 2011 4:31 pm
- Location: Floating Around
-
- Posts: 1
- Joined: Tue Aug 07, 2012 8:00 pm
This is confusing
Hello, I easily understood what needs doing and implemented it with PHP bcmath. Yet after reading:
"Now take every 33rd digit of x, starting with the first (most significant), and stick them together."
I interpreted as "use digits 33, 66 etc", while it looks like the needed digits are 1, 34 etc. Luckily there are some hints in the not-done forum to clarify this, but since I look at hints as a last resort I ended up doing the calculation in multiple languages as I never suspected the issue was with correctly interpreting the challenge. I think a better challenge text would be:
"Take the first digit then every thirty-third digit after it, i.e. digit 1, digit 34, digit 67 etc, and stick them together."
"Now take every 33rd digit of x, starting with the first (most significant), and stick them together."
I interpreted as "use digits 33, 66 etc", while it looks like the needed digits are 1, 34 etc. Luckily there are some hints in the not-done forum to clarify this, but since I look at hints as a last resort I ended up doing the calculation in multiple languages as I never suspected the issue was with correctly interpreting the challenge. I think a better challenge text would be:
"Take the first digit then every thirty-third digit after it, i.e. digit 1, digit 34, digit 67 etc, and stick them together."
java :
Code: Select all
package hacker.org;
import java.math.BigInteger;
public class ThePowersThatBe {
public static void main(String[] args) {
BigInteger b = new BigInteger("17");
b = b.pow(39);
b = b.pow(11);
String resOp = b.toString();
String sol = "";
for(int i=0;i<resOp.length();i=i+33)
sol += resOp.charAt(i);
System.out.println(sol);
}
}
-
- Posts: 1
- Joined: Wed Jan 06, 2021 10:13 am