pouët.net

Any demoscener from Mensa?

category: residue [glöplog]
BTW, when I wrote n = 2 to n = 6 above, I meant n = 3 to n = 7 ...
added on the 2006-11-26 14:42:04 by Adok Adok
The output of my program is:
Quote:
n=3: 4 * 2178
n=3: 9 * 1089
n=4: 4 * 21978
n=4: 9 * 10989
n=5: 4 * 219978
n=5: 9 * 109989
n=6: 4 * 2199978
n=6: 9 * 1099989
n=7: 4 * 21782178
n=7: 4 * 21999978
n=7: 9 * 10891089
n=7: 9 * 10999989
For n > 7, the program produces bullshit since the values sometimes become too big for 32 bit integers.

Anyway, we see that
F(0) = 0
F(1) = 0
F(2) = 0
F(3) = 2
F(4) = 2
F(5) = 2
F(6) = 2
F(7) = 4

This means:

F(n) = int((n + 1) / 4)

for 0 <= n <= 7 where n = number of digits - 1. I wonder if this also applies to n > 7.
added on the 2006-11-26 15:04:23 by Adok Adok
it makes F(7) = 2.
and F(9) = 6
because we have
1099999989 * 9 = 9899999901
2199999978 * 4 = 8799999912
1098910989 * 9 = 9890198901
2197821978 * 4 = 8791287912
1089001089 * 9 = 9801009801
2178002178 * 4 = 8712008712

sorry but your code makes no sense, it is not hard to find the numbers fast by hand. giving their count without calculating them is the problem.
and the function can be given with a combinadic equation. but i guess it wouldn't be elegant compared to a recursive one.
Why do you think F(7) = 2? I showed that there are 4 numbers for n = 7.
added on the 2006-11-26 16:01:08 by Adok Adok
the function you offered F(n) = int((n + 1) / 4) gives F(7) = 2.
and F(n) = int((n + 1) / 4) * 4 gives F(9) = 4, which again is wrong.
OK, it's F(n) = 2 * int((n + 1) / 4).
added on the 2006-11-26 16:06:41 by Adok Adok
The function is only supposed to be correct for 0 <= n <= 7. I haven't evaluated other n.
added on the 2006-11-26 16:07:18 by Adok Adok
you could as well calculate a few more data points and find a nearer function for small n.

it's not the point.
Hey guys, go on! First, even with 32 integers numbers it is easy to make more than 7 digits of precission. Try to calc to 12-14 digits at least (it should take few seconds if the program is done correctly). It will be useful to understand the problem.

Then think a bit with your brain. It is obvious that digits has a big relation between them. Remember the multiplication algorithm (the school boy one). Remember also easy things about discrete maths and module 10 and module 10^n.

You are in the right way guys :D
added on the 2006-11-26 16:21:48 by texel texel
And a note: by an incomplete definition in my problem, there are 8 solutions when N=1:

2*0=0
3*0=0
...
9*0=0

This is just an exception.
added on the 2006-11-26 16:26:20 by texel texel
it's not an exception. 0 isn't bigger than or equal to 2 ;)
A with 4 decimal digits and B with 1 decimal digit and bigger or equal than 2...

I'm talking about A, not B.
added on the 2006-11-26 16:36:47 by texel texel
0 should be 0 digits :P
Well... it depends on the definition of natural numbers... you know, in some places are defined as 0, 1, 2..., in others 1, 2, 3... It depends of the book.
added on the 2006-11-26 16:38:22 by texel texel
But whatever, this doesn't affect the whole problem at all :D
added on the 2006-11-26 16:39:19 by texel texel
:) ok if the result is
f(4) = 2
f(5) = 2
f(6) = 2
f(7) = 2
f(8) = 4
f(9) = 4
f(10) = 6
f(11) = 6
f(12) = 12
f(13) = 12
f(14) = 18
f(15) = 18
f(16) = 28
f(17) = 28
f(18) = 42
f(19) = 42

i will explain why, else i won't bother :D
oh that's wrong. my result is actually:
f(n) =
0 ; n < 4
2 + sum(i = 4 to n/2)(2 + f(n - i*2)) ; n >= 4
ok that's again wrong. there are two sums.

it should go like (from n = 4):
2 2 2 2 4 4 6 6 10 10 16 16 26 26 42 42 68 68 110 110 178 178 288 288 466 466

don't tell me i'm not even near :)
anes, I think your program is not working correctly...
added on the 2006-11-26 17:30:44 by texel texel
your last serie:

2 2 2 2 4 4 6 6 10 10 16 16 26 26 42 42 68 68 110 110 178 178 288 288 466 466

Is correct.

Go on!
added on the 2006-11-26 18:13:53 by texel texel
(I wrote "anes, I think your program is not working correctly..." just in the moment you were writing your last post)
added on the 2006-11-26 18:14:50 by texel texel
i was about to write "i found the fibonacci sequence by mistake then".

:D

login