Search found 546 matches

by jaap
Sun Feb 01, 2015 4:48 pm
Forum: Programming languages
Topic: [C++] GMP hamming weight
Replies: 3
Views: 8456

Re: [C++] GMP hamming weight

For fixed length integers (e.g. 32 bit ints) there is a well known clever way to do this: int countBits(unsigned x) { x = x - ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x + (x >> 4)) & 0x0F0F0F0F; x = x + (x >> 8); x = x + (x >> 16); return x & 0x0000003F; } Howeve...
by jaap
Wed Jan 14, 2015 8:36 am
Forum: News, Suggestions, and FAQ
Topic: Errors/Warnings/Bugs
Replies: 579
Views: 180232

Re: Problem 8 is blank?

This also breaks the "View the details of all problems on one page" option. It shows nothing beyond problem 7.
by jaap
Tue Jan 13, 2015 11:44 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 497
Replies: 5
Views: 2721

Re: Problem 497

Thanks, hk.
by jaap
Tue Jan 13, 2015 2:40 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 497
Replies: 5
Views: 2721

Problem 497

In 497 it says: Let E(n,k,a,b,c) be the expected minimal number of squares that Bob travels during a single optimally-played game. I don't understand what "minimal" means here. What is being minimised? It already says it is for the optimal game. To me, minimal would be when the randomly chosen direc...
by jaap
Sat Jan 03, 2015 4:16 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 182
Replies: 10
Views: 4167

Re: Problem 182

leghorn wrote:The numbers are p=1009 and q=3643. Since phi is (p-1)(q-1), shouldn't the last line read phi(1008, 3642)?
No, it is written as if phi is a function of p and q, so as phi(p,q). So it is either (p-1)(q-1) or phi(p,q), which are equal by definition, but not some bizarre mix of the two.
by jaap
Wed Dec 31, 2014 9:19 am
Forum: Clarifications on Project Euler Problems
Topic: Problem 030
Replies: 5
Views: 2676

Re: Problem 030

Wow this is so stupid. Clearly 10 is a sum of its digits to the fourth power. No, it isn't the sum of its digits to the fourth power. 1^4+0^4 is not equal to 10. And the reasoning "As 1 = 1^4 is not a sum it is not included." is SO stupid! As 6^4 is not a sum it should not included as well, but it ...
by jaap
Wed Dec 31, 2014 9:15 am
Forum: Clarifications on Project Euler Problems
Topic: Problem 027
Replies: 25
Views: 9791

Re: Problem 027

aware wrote:are a and b necessarily integers? Or can they be rational/irrational?
What does the polynomial evaluate to for n=0 and n=1?
by jaap
Mon Dec 22, 2014 10:04 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 494
Replies: 10
Views: 4069

Re: Problem 494

Not asking for hints or clues, but would kindly request an explanation on the meaning of this wording: Let Sm be the set of all sequence prefixes of length m. Two sequences {a1, a2, ..., am} and {b1, b2, ..., bm} in Sm are said to belong to the same prefix family if ai < aj if and only if bi < bj f...
by jaap
Tue Dec 16, 2014 11:21 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 234
Replies: 4
Views: 2170

Re: Problem 234

That's the correct sum.
by jaap
Tue Dec 16, 2014 10:49 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 234
Replies: 4
Views: 2170

Re: Problem 234

54 should not be on your list, but 55 should.
by jaap
Mon Dec 15, 2014 7:05 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 407
Replies: 9
Views: 4834

Re: Problem 407

All of that is correct.
by jaap
Sat Nov 29, 2014 12:34 am
Forum: News, Suggestions, and FAQ
Topic: New awards.
Replies: 68
Views: 31314

Re: New awards.

(Sorry if this is in the wrong place) Could someone confirm how Decimation II works? I read it to mean one problem from each of 20X, 21X, 22X...29X, so at least 10 problems with one from each decade between 200->300. I've completed it to my understanding but it's not shown up. Thanks The way I read...
by jaap
Mon Nov 03, 2014 10:49 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 487
Replies: 5
Views: 3079

Re: Problem 487

You can interpret the question as follows: Define T k (n,p) as S k (n) mod p. The problem then asks for [sum]T k (n,p) Albert's point is that this is mathematically sloppy. The integers mod p form a field, Z p = Z/pZ for any prime p. It is not possible to add an element of say Z 5 to an element of ...
by jaap
Wed Oct 29, 2014 11:02 am
Forum: Clarifications on Project Euler Problems
Topic: Problem 431
Replies: 10
Views: 4587

Re: Problem 431

Hi, I don't understand why 1.114785284 has 3 squared decimal places ... At first sight, I see "1" twice and "4" twice too, giving thus 4 places... So this is not about single digits being squares... Can someone please explain me the decision criterion ? Many thanks for your help ! It simply has 9 d...
by jaap
Thu Oct 23, 2014 9:09 am
Forum: Recreational
Topic: Cryptographic system puzzle
Replies: 0
Views: 2756

Re: Cryptographic system puzzle

Here is a 14x14 board for k=2. A...D...G...J. BC..EF..HI..K. .A...D...G...J .BC..EF..HI..K .............. .............. L...O...R...U. MN..PQ..ST..V. .L...O...R...U .MN..PQ..ST..V .............. .............. WXY....Z12.... ..WXY....Z12.. For larger k you can similarly build boards by putting toge...
by jaap
Wed Oct 22, 2014 10:07 am
Forum: Recreational
Topic: The Tetris Problem
Replies: 6
Views: 4811

Re: The Tetris Problem

Here are a few simpler solutions for width 4, where the straight piece (not shown) is slotted in last. Unlike the solution in my previous post, these never have any unconnected floating squares when rows disappear. TTT. LTSS LSS. LLOO ZZOO JZZ. JJJ. ----- OOS. OOSS LLLS LTTT ZZT. JZZ. JJJ. ----- LLL...
by jaap
Tue Oct 21, 2014 4:55 pm
Forum: Recreational
Topic: The Tetris Problem
Replies: 6
Views: 4811

Re: The Tetris Problem

Here is a solution for the width 4 problem.

Code: Select all

S...
SSOO
.SOO

S...
.SOO

...L
SLLL
.SOO

...L
.SOO

.J.Z
.JZZ
JJZL
.SOO

.J.Z
.JZZ
.SOO

ITTT
IJTZ
IJZZ
ISOO
I wrote a little computer program for it, as I was not able to get anything by hand. This is the first solution it produced.
by jaap
Sat Oct 18, 2014 9:28 pm
Forum: Recreational
Topic: The Tetris Problem
Replies: 6
Views: 4811

Re: The Tetris Problem

How about this:

Code: Select all

L......
LIIIIOO
LL...OO

.......
L......
LL...OO

TTTZJJJ
LTZZSSJ
LLZSSOO
The 7 rows of width 4 seems trickier, and I have not yet found a solution.
by jaap
Wed Sep 17, 2014 8:48 am
Forum: Combinatorics
Topic: Combinatorial problem
Replies: 1
Views: 7177

Re: Combinatorial problem

lopez25 wrote:You can not build the 5-uple 1-2-3-4-5 if at least one of the triplet 1-2-3 or 1-2-4 is missing.
I don't understand how you are building the 5-tuples.
If you are just taking the union of some triplets, then for example {1,4,5} and {2,3,4} build {1,2,3,4,5} without using either {1,2,3} or {1,2,4}.
by jaap
Thu Aug 21, 2014 9:46 am
Forum: Clarifications on Project Euler Problems
Topic: Problem 058
Replies: 32
Views: 12006

Re: Problem 058

If you think everything's working correctly and you've run out of prime numbers, what course of action do you think this suggests? Generate more primes ? :D I'am sorry but I have been stuck on this problem for 3 days generating up to 707081281 sieve matrix and still hitting ~10% ratio The code take...