Re: Director of Innovative Technologies Labs Community Center Say Hello! by Dani Hello and welcome to DaniWeb. That’s quite the CV you’ve got there. :) Rice Golumb coding Programming Software Development by blackmagic01021 I am using Rice-Golumb encoding for image compression. Compression and decompression working perfectly … Re: A grain of rice Community Center Geeks' Lounge by jwenting Rice is an important staple food, it should get more attention. Re: Grains of rice on a chessboard (golang) Programming Computer Science by vegaseat …) func main() { fmt.Println("Grains of rice on a chessboard (doubling every square):n")….0 // assume 29000 grains in 1 pound of rice grainsPerPound := 29000.0 totalGrains := math.Pow(2,…Println("Assume 29000 grains per pound of rice:") totalPound := totalGrains / grainsPerPound fmt.Printf… Re: A grain of rice Community Center Geeks' Lounge by Catweazle …can be increased by the use of ridge farming and rice-fish cultivation, where 'crops' complement each other side …Products Station of Chishui County revealed that ridge-rice cultivation could improve rice tillering and increase average grain weight. In … 7-cm fingerlings. The flat field yielded 170 kg rice and 12.6 kg fish. The ridge field yielded… Grains of rice on a chessboard (Python) Programming Software Development by vegaseat …. The creator of the game simply wanted one grain of rice put on the first square of the chessboard, two grains… the humble request, had his helpers bring a bag of rice and started to fill the squares. Did the creator of… Grains of rice on a chessboard (golang) Programming Computer Science by vegaseat …. The creator of the game simply wanted one grain of rice put on the first square of the chessboard, two grains… the humble request, had his helpers bring a bag of rice and started to fill the squares. Did the creator of… Re: Grains of rice on a chessboard (golang) Programming Computer Science by vegaseat Hmm, if you stacked the rice grains end to end, at what square would you have … grains to reach the moon? Assume that a grain of rice is 5 mm long. On average, the distance from Earth… Re: Grains of rice on a chessboard (Python) Programming Software Development by vegaseat …` Here is some code ... ''' chessboard_grains2.py putting one grain of rice on the first square of a chessboard two grains of… rice on the second square and doubling it every remaining square … Re: A grain of rice Community Center Geeks' Lounge by kc0arf Hello, I would clarify. What brand / type of rice? Wild Rice? Cooked or uncooked? :) Sorry. If I had to guess, I would say 1/2 gram. Christian Re: A grain of rice Community Center Geeks' Lounge by jwenting if you're into Ethiopian cooking it doesn't matter what the weight is. Just hold some rice (a few grains will do) near (but no closer than half a meter) from a cup of boiling water. Reuse that rice for the next year. Re: A grain of rice Community Center Geeks' Lounge by talkfreelance Only way to find out...buy a bag of rice, count the rice and divide by the weight! :) Re: A grain of rice Community Center Geeks' Lounge by vegaseat Gee thanks Grandad, keeps me from buying a pound of rice and counting 16,000 of the darn things! Let's agree on 28 milligrams per grain of average rice. A grain of rice Community Center Geeks' Lounge by vegaseat Does anybody know the weight of a grain of rice? I am into Ethiopian cooking. Re: A grain of rice Community Center Geeks' Lounge by 3265002918 i like rice Re: A grain of rice Community Center Geeks' Lounge by 3265002918 put i am not sure if i like ethiopian rice Re: A grain of rice Community Center Geeks' Lounge by 3265002918 [QUOTE=jasondrey13]put i am not sure if i like ethiopian rice[/QUOTE] but* Re: A grain of rice Community Center Geeks' Lounge by 3265002918 why is everyone talking about a grain of rice? Re: A grain of rice Community Center Geeks' Lounge by YoungCoder What about pizza, I am sure a pizza is more healthy than a bag of rice :) Re: A grain of rice Community Center Geeks' Lounge by 3265002918 i knew it they make rice with staples sry age:7 hehe Re: A grain of rice Community Center Geeks' Lounge by YoungCoder [QUOTE=jasondrey13]i knew it they make rice with staples sry age:7 hehe[/QUOTE] I have no idea what you are talking about :rolleyes: Re: Rice Golumb coding Programming Software Development by Aranarth Just check if all values in the resulting long array are within the value range of short. If so, you can transfer the data over to a short array. Re: Grains of rice on a chessboard (Python) Programming Software Development by Slavi Oh, this is a good one. I remember it when my high school teacher was telling us the story! Re: Grains of rice on a chessboard (Python) Programming Software Development by DaveAmour @Slavi - There is a famous chess opening called the Slav Re: Grains of rice on a chessboard (Python) Programming Software Development by Gribouillis The first grain is missing in `grains_sum`. The result is `2**65-1`, an odd number. Re: Grains of rice on a chessboard (Python) Programming Software Development by vegaseat Thank you so much Gribouillis! I made the corrrection. Looks like I lack the basic mathematical concepts too! Re: Grains of rice on a chessboard (golang) Programming Computer Science by rubberman The answer is simple: 2^64 - 1. Why bother with the loop? Re: Grains of rice on a chessboard (golang) Programming Computer Science by Ene Uran There is no 2^64-1 for such large numbers. Re: Grains of rice on a chessboard (golang) Programming Computer Science by vegaseat In Go ^ is the exclusive or. Python gives the accurate result 2**64 - 1 = 18446744073709551615 The code was meant to be a good exercise in big math and its accuracy. Once you use the test print in the loop, you can illustrate the progression quite nicely. Re: Grains of rice on a chessboard (Python) Programming Software Development by Gribouillis See this [wikipedia entry](https://en.wikipedia.org/wiki/Finite_geometric_series) for the finite geometric series which applies here. Take a=1 and r=2 in wikipedia's formula.