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 ...
The output of my program is:
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.
Quote:
For n > 7, the program produces bullshit since the values sometimes become too big for 32 bit integers.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
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.
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.
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.
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).
The function is only supposed to be correct for 0 <= n <= 7. I haven't evaluated other n.
you could as well calculate a few more data points and find a nearer function for small n.
it's not the point.
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
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
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.
2*0=0
3*0=0
...
9*0=0
This is just an exception.
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.
I'm talking about A, not B.
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.
But whatever, this doesn't affect the whole problem at all :D
:) 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
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
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 :)
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...
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!
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!
(I wrote "anes, I think your program is not working correctly..." just in the moment you were writing your last post)
i was about to write "i found the fibonacci sequence by mistake then".
:D
:D