13
u/dhvl2712 Jul 09 '14
Hang the fuck on. There's no way in hell, he just wrote the literal string '512 bit int' and expected it to work. He might've meant it as a placeholder or something.
5
u/weirdasianfaces Jul 09 '14
OP comes from a Python background it looks like. I thought the same but in no way did he indicate that was a placeholder though.
16
0
Jul 12 '14
[deleted]
2
u/glitchn Jul 12 '14
Sure its possible, but theres not much need for it and there are often better ways to store and work with such large numbers.
10
u/hatsune_aru Jul 09 '14
Was that a troll question?
32
u/weirdasianfaces Jul 09 '14
Nope. OP seemed pretty happy to find out about the BigInteger struct.
31
77
u/SuperFLEB Jul 09 '14
"What am I doing wrong?"
All of it, actually.
15
u/GrantSolar Jul 09 '14
It's quite spectacular how every bit of it is terrible. Even the variable name 'startPrime'. "Yeah, I'll just generate a random number and it'll be prime, since there's infinitely many it's a dead cert!"
1
49
u/ekolis Jul 09 '14
No, silly! That's not how you do it! A regular int is 32 bits, so what you need to do is ToString() eight regular ints, then concatenate them all, then Int.Parse() the result.
16
u/Famous1107 Jul 09 '14
store that as, ReallyBigInt urbi = ReallyBigInt.Parse("99999999999999999999999...");
The u denotes an unsigned ReallyBigInt, also known as a big ass int.
105
u/northrupthebandgeek Jul 09 '14
It looks like his issue is that he's using C#. He should try using a real programming language, like Visual Basic.
38
Jul 09 '14
Haha visual basic. You kids. Why don't you use a battle tested, tried and true language like QBasic?
You and your 6.0 this and your dot net that. Its all a flash in the pan, mark my words. In six months, no one will be blogging about VB anymore.
17
4
0
10
u/XL_ARES_IX Jul 09 '14
Or Java. In fact, I made some code to help him out
int my512Integer = Integer.getInteger("512"); //this generates a new 512 bit integer Random random = new Random(my512Integer); int newRandom = random.nextInt();29
u/tusksrus Jul 09 '14
java.util.Integer512BitInteger myInteger512BitInteger = java.util.Integer512BitInteger.createInteger512BitInteger(new java.util.Integer512BitIntegerFactory(), java.lang.Integer.getInteger("512"));8
u/ajs124 Jul 09 '14
please tell me this isn't real, please tell me this isn't real.
16
6
1
2
23
7
u/davidwhitney Jul 09 '14
I resisted the urge to post this here, but as far as WTFs/Minute go, this is a new classic.
5
Jul 09 '14
Language is fine, but since bit isn't defined, 512-bit gives an error.
2
u/FalconGames109 Jul 09 '14
The problem is probably the dash. It is being detected as the minus sign, so the method expects a negative number or something but nothing comes after.
-11
-3
38
u/ich_bin_Sal Jul 09 '14
I want to know the train of thought of OP to come to the conclusion "hmm, I need to generate a FIVE HUNDRED AND TWELVE bit integer"