- Post Reply Bookmark Topic Watch Topic
- New Topic

programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums

this forum made possible by our volunteer staff, including ...

Marshals:

- Campbell Ritchie
- Devaka Cooray
- Liutauras Vilda
- Jeanne Boyarsky
- Bear Bibeault

Sheriffs:

- Paul Clapham
- Knute Snortum
- Rob Spoor

Saloon Keepers:

- Tim Moores
- Ron McLeod
- Piet Souris
- Stephan van Hulst
- Carey Brown

Bartenders:

- Tim Holloway
- Frits Walraven
- Ganesh Patekar

posted 16 years ago

Today after church, a local high school math teacher showed me a neat little parlor trick. Take a look at the code below and see if you can figure out why it works (Jim, give everyone else a chance first ). Basically you take two random positive integers, although positive reals would also work, then begin summing them fibonacci style until you have ten integers. Then you sum all of them. By taking the seventh element and multiplying by 11 you will always get the correct sum. Here's the code:

*Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction.* - Ernst F. Schumacher

posted 16 years ago

Why 11? I'm not sure. I can of course prove this, but cannot explain why 11 is the magic number.

Likewise, if you do this for only 6 elements, the sum of all the elements is equal to 4 times the fifth element.

And if you do it for 14 elements the sum of all the elements is equal to 29 times the ninth element.

And Sum(18 elements) = 76 * the eleventh element

Likewise, if you do this for only 6 elements, the sum of all the elements is equal to 4 times the fifth element.

And if you do it for 14 elements the sum of all the elements is equal to 29 times the ninth element.

And Sum(18 elements) = 76 * the eleventh element

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.

posted 16 years ago

Don't overlook sum(4 elements) = 4 * (3rd element)

It seems as though these sorts of relationships are not terribly uncommon in this sequence. What's special about 11? Perhaps it's just that it's easy to spot a multiple of 11 - so when some mathematician was developing formulas for sums of Fibonacci series, they noticed a couple terms with 55 and 88 in them, and said "hey look - those are divisible by 11". Which was slightly more noticeable than some of the other patterns. Well, the one I cited was pretty obvious too - just kind of boring. (Unlike all the other patterns here, of course.)

Oh, yes, while we're at it:

sum(1 element) = 1 * (1st element) :roll:

[ May 25, 2003: Message edited by: Jim Yingst ]

It seems as though these sorts of relationships are not terribly uncommon in this sequence. What's special about 11? Perhaps it's just that it's easy to spot a multiple of 11 - so when some mathematician was developing formulas for sums of Fibonacci series, they noticed a couple terms with 55 and 88 in them, and said "hey look - those are divisible by 11". Which was slightly more noticeable than some of the other patterns. Well, the one I cited was pretty obvious too - just kind of boring. (Unlike all the other patterns here, of course.)

Oh, yes, while we're at it:

sum(1 element) = 1 * (1st element) :roll:

[ May 25, 2003: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, *Twister*

Michael Morris

Ranch Hand

Posts: 3451

posted 16 years ago

As a parlor trick, most mathematically inclined can come up with a multiple of 11 without pencil and paper. Just ask for the seventh element and produce the answer before they even finish the series. Real Chick Magnet stuff!

*Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction.* - Ernst F. Schumacher

posted 16 years ago

I overlooked that one because it isn't true.

For positive a and b,

3a + 4b != 4a + 4b

There only seems to be a ralationship between the sum and an element when

elements.length > 2 && elements.length % 4 == 2

Hence my citing 6, 14, and 18. (And, of couse, as you pointed out, 1 :roll: )

The real question is, given what we know, can we predict the multiple for length == 22?

Of course, I'm just assuming that a). There is an integral solution and b). The element in question will be number 13. These seems to be safe assumptions, however, given the pattern as seen so far.

(You can easily modify Michael's code to arive at the answer emperically. I would like to know how to arrive at the solution without the emperical test...)

[ May 25, 2003: Message edited by: Joel McNary ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.

Originally posted by Jim Yingst:

Don't overlook sum(4 elements) = 4 * (3rd element)

I overlooked that one because it isn't true.

For positive a and b,

3a + 4b != 4a + 4b

There only seems to be a ralationship between the sum and an element when

elements.length > 2 && elements.length % 4 == 2

Hence my citing 6, 14, and 18. (And, of couse, as you pointed out, 1 :roll: )

The real question is, given what we know, can we predict the multiple for length == 22?

Of course, I'm just assuming that a). There is an integral solution and b). The element in question will be number 13. These seems to be safe assumptions, however, given the pattern as seen so far.

(You can easily modify Michael's code to arive at the answer emperically. I would like to know how to arrive at the solution without the emperical test...)

[ May 25, 2003: Message edited by: Joel McNary ]

Jim Yingst

Wanderer

Posts: 18671

posted 16 years ago

Sorry, I mixed up my table of Fibonacci number formulas with my table of sums of Fibonacci number formulas. Careless. I should have said

sum(3 elements) = 2 * (3rd element)

sum(3 elements) = 2 * (3rd element)

"I'm not back." - Bill Harding, *Twister*

posted 16 years ago

From 11, I remembered that simple trick of multiplying any number by 11.Many of you many be aware of that.e.g. 4959 X 11.

1) Write the last digit first ,i,e.9

2) Write the sum of digit and its adjacent digit to its left and carryover if more than 9.In this case,W'll write 4 ,and 1 as a carry over.

3)Repeat the step 2 until you reach the leading first digit,in this case 4.

Remember ,number should be written as 04959.

1) Write the last digit first ,i,e.9

2) Write the sum of digit and its adjacent digit to its left and carryover if more than 9.In this case,W'll write 4 ,and 1 as a carry over.

3)Repeat the step 2 until you reach the leading first digit,in this case 4.

Remember ,number should be written as 04959.

MH

posted 16 years ago

Ah, that makes it better.

The pattern for predicting x (x = f(count) happens to be:

f(count) = 3* f(count-4) - f(count-8)

Note that since there is no closed-form formula for predicting the nth element of the Fibbonici sequence, there is no closed form formula for predicting these numbers (you just have to work on what you already know)

The Element in question is (count+4)/2

This means, of course, that for length 22, the element is question is (22+4)/2, or 13, and the number is 3*76 - 29, or 199.

The interesting thing is working backwards. If we allowed count = 2, then Element # = 3 (count + 4) / 2. This would make little sense, unles we changed out definition of the problem a little so that we are calculating the sum of the first count elements, thereby permitting elements beyound count. Solving (backwards) for x, we get x = 1 (x = 4 * 3 - 11). Therefore, the sum of the first two elements is equal to 1 * the third element.

This is just a little*less* insightful (and is certainly less of a Chick Magnet ) than any of the other examples, but it does fit the pattern and thereby satisfies my obsession with this problem.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.

Originally posted by Jim Yingst:

Sorry, I mixed up my table of Fibonacci number formulas with my table of sums of Fibonacci number formulas. Careless. I should have said

sum(3 elements) = 2 * (3rd element)

Ah, that makes it better.

The pattern for predicting x (x = f(count) happens to be:

f(count) = 3* f(count-4) - f(count-8)

Note that since there is no closed-form formula for predicting the nth element of the Fibbonici sequence, there is no closed form formula for predicting these numbers (you just have to work on what you already know)

The Element in question is (count+4)/2

This means, of course, that for length 22, the element is question is (22+4)/2, or 13, and the number is 3*76 - 29, or 199.

The interesting thing is working backwards. If we allowed count = 2, then Element # = 3 (count + 4) / 2. This would make little sense, unles we changed out definition of the problem a little so that we are calculating the sum of the first count elements, thereby permitting elements beyound count. Solving (backwards) for x, we get x = 1 (x = 4 * 3 - 11). Therefore, the sum of the first two elements is equal to 1 * the third element.

This is just a little

Jim Yingst

Wanderer

Posts: 18671

posted 16 years ago
**...and is certainly less of a Chick Magnet ...**

It*is* hard to understand why there aren't more hot babes drawn in to these discussions.

It

"I'm not back." - Bill Harding, *Twister*

Michael Morris

Ranch Hand

Posts: 3451

posted 16 years ago
**It is hard to understand why there aren't more hot babes drawn in to these discussions.**

Go figure!

Go figure!

*Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction.* - Ernst F. Schumacher

posted 16 years ago

yeah

i found the generalization!!!

i will post it provided i can write in on paper and scan it.

i will write a program to get f(n) for fibo things so u can make sure about the answer.

i used to love math once upon a time.

regards

maulin

i found the generalization!!!

i will post it provided i can write in on paper and scan it.

i will write a program to get f(n) for fibo things so u can make sure about the answer.

i used to love math once upon a time.

regards

maulin

Michael Morris

Ranch Hand

Posts: 3451

posted 16 years ago
**i will write a program to get f(n) for fibo things so u can make sure about the answer.**

I know a high school math teacher that will be very happy to know the solution.

I know a high school math teacher that will be very happy to know the solution.

Maulin Vasavada

Ranch Hand

Posts: 1873

posted 16 years ago

hi all,

here is the C code that i wrote to find out the general solution.

here, this will fail for case 1 that is count=6. and in this specific case i observe that the 'x' is 4 which is "square root" of "2" and i 've some "magical predictions" based on my theory that might lead us to something concrete decision but i can't explain it here as i have not mentioned how did i came up with the above program?

(thats why i told that i would provide the scanned page where i have the logic to come up with the above code. i will try to do it).

regards

maulin

here is the C code that i wrote to find out the general solution.

here, this will fail for case 1 that is count=6. and in this specific case i observe that the 'x' is 4 which is "square root" of "2" and i 've some "magical predictions" based on my theory that might lead us to something concrete decision but i can't explain it here as i have not mentioned how did i came up with the above program?

(thats why i told that i would provide the scanned page where i have the logic to come up with the above code. i will try to do it).

regards

maulin

Maulin Vasavada

Ranch Hand

Posts: 1873

posted 16 years ago

btw,

sorry for writing C code but i just felt 'attracted' to write this in C rather than in Java. i donno why.

regards

maulin

sorry for writing C code but i just felt 'attracted' to write this in C rather than in Java. i donno why.

regards

maulin

posted 16 years ago
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.

Fascinating code. I played around with it for a little bit and see what it's doing, but I would love to know *why it works*.

For those of you who do not have a C-compiler installed (like me), here is the Java version (I renamed the function names to make it more readable to non-mathematicians)

For those of you who do not have a C-compiler installed (like me), here is the Java version (I renamed the function names to make it more readable to non-mathematicians)

Maulin Vasavada

Ranch Hand

Posts: 1873

posted 16 years ago

hi all,

i have scanned 5 pages where i have written the apporach i had. all the pages are scanned in GIF format and i have a winzip file created for it but how do i post here?

regards

maulin

i have scanned 5 pages where i have written the apporach i had. all the pages are scanned in GIF format and i have a winzip file created for it but how do i post here?

regards

maulin

posted 16 years ago
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.

You can't actually post it directly here on the boards, but you can publish it to a different web site and then link to it (preferably using the [ URL ] tag.

Maulin Vasavada

Ranch Hand

Posts: 1873

posted 16 years ago

well,

thats the essential problem i have. i dont have any URL where i can upload it. i had my school's site but now it doesn't work after i graduated

can i send it to any of you in email, who can in turn upload it on some site and use the url tag to make it available to all?

regards

maulin

thats the essential problem i have. i dont have any URL where i can upload it. i had my school's site but now it doesn't work after i graduated

can i send it to any of you in email, who can in turn upload it on some site and use the url tag to make it available to all?

regards

maulin

Michael Morris

Ranch Hand

Posts: 3451

posted 16 years ago

You can upload them to my company site. I set you up an account and I'll send you a private message giving you the specifics. Once you upload them, I'll link them here.

Maulin Vasavada

Ranch Hand

Posts: 1873

posted 16 years ago

hi Michael Morris,

i uploaded the file called "theory.zip" to the location you provided.

thank you very much for the help.

let me know if you find problems in accessing the file or anything.

regards

maulin

i uploaded the file called "theory.zip" to the location you provided.

thank you very much for the help.

let me know if you find problems in accessing the file or anything.

regards

maulin

Michael Morris

Ranch Hand

Posts: 3451

posted 16 years ago

I tried linking the GIFs here but they were so huge I deleted the post. I'm going to convert them to jpegs and then post them.

Michael Morris

Ranch Hand

Posts: 3451

posted 16 years ago

Here are Maulin's GIFs

Thanks again Maulin

Thanks again Maulin

Maulin Vasavada

Ranch Hand

Posts: 1873

posted 16 years ago

hi all,

also to reach on more simple solution,

we can say that if we are given "count" then,

# = (count+4)/2.

e.g.

count = 6, # = 5

count = 10, # = 7

count = 14, # = 9 etc...

and from my theory after simplification of index starting from 1 instead of 0 we can derive,

constant 'x' = [F(count) -1]/F(count/2)

Where,

F(i) = is the i th term in classic fibonacci series and i starts from 1.

=>

F(1) = 0,

F(2) = 1,

F(3) = 1 etc...

count = 10, F(10) = 34, F(5) = 3 and so,

'x' = (34 - 1)/3 = 11.

count = 14 , F(14) = 233, F(7) = 8 and so,

'x' = (233-1)/8 = 29 and so on...

regards

maulin

also to reach on more simple solution,

we can say that if we are given "count" then,

# = (count+4)/2.

e.g.

count = 6, # = 5

count = 10, # = 7

count = 14, # = 9 etc...

and from my theory after simplification of index starting from 1 instead of 0 we can derive,

constant 'x' = [F(count) -1]/F(count/2)

Where,

F(i) = is the i th term in classic fibonacci series and i starts from 1.

=>

F(1) = 0,

F(2) = 1,

F(3) = 1 etc...

count = 10, F(10) = 34, F(5) = 3 and so,

'x' = (34 - 1)/3 = 11.

count = 14 , F(14) = 233, F(7) = 8 and so,

'x' = (233-1)/8 = 29 and so on...

regards

maulin

posted 10 months ago

hi Herbal,

welcome to the Ranch and enjoy the stay!

If one sums the terms, the series of terms for a will be a Fibonacci(1, 0) and for b it will be Fibonacci(0, 1). The 7th term of the simple series is 5a + 8b, the 10th term of the sum is 55a + 88b. So I get the impression that that teacher is right...

But I had not written a Fibonacci in Stream form, so grabbed the opportunity:

welcome to the Ranch and enjoy the stay!

If one sums the terms, the series of terms for a will be a Fibonacci(1, 0) and for b it will be Fibonacci(0, 1). The 7th term of the simple series is 5a + 8b, the 10th term of the sum is 55a + 88b. So I get the impression that that teacher is right...

But I had not written a Fibonacci in Stream form, so grabbed the opportunity:

There are three kinds of actuaries: those who can count, and those who can't.

Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |

- Post Reply Bookmark Topic Watch Topic
- New Topic

Boost this thread!