What's the next number in the sequence

I was writing this LOD algorithm and found a certain sequence of values (by trial and error) for culling
the quads in the center, to make place for a higher LOD. Ofcourse the numbers became too hard to
narrow down in the following LODs, so I needed the formula!

So far for the introduction-story, which can be forgotten right away.

For this who like silly math assignments…

Give me the next 2 numbers of this sequence.

2, 6, 26, 114, ..., ..., etc

It’s a nasty one, and took me 15 minutes. Now I wonder what others come up with :slight_smile:

one solution should be:

2^(2*n+1) - 2^(n+1) + 2 for n elem |N_0

sorry, I’m to lazy to put in n=4,5

took me also about 15min without a calculator (5 min for the formula and 10 min proof :slight_smile:

would have been faster but I thought of 2^prim(2+n) - … because you sad it’s a nasty one :wink:

I started with 1 instead of 0 (because of how the algorithm works).


|N_0 = 2^(2*n+1) - 2^(n+1) + 2
|N_1 = 2^(2*n-1) - 2^n + 2

Saves 1 addition :wink:

I solved it during a chat-session about something else, got kinda hard to concentrate.

This is the first time I encountered a numeric-sequence that wasn’t too obvious…

I hope it enjoyed your neurons a bit.

OUCH! Just stubbed my brain…

-Chris

that’s a nice formula.

now I want an explanation how it works ;D

Well… if I’d say that it’s top-secret, I’d lie.

Consider a grid of cells,
with inside it, another grid of smaller cells,
with inside it, another grid of smaller cells,
with inside it, another grid of smaller cells,
etc.

Which ‘center cells’ inside the LOD should be culled to prevent overlap?
That’s what this formula calculates.

BTW, the placement of the lower LOD-grids, is corrected (snapped) by:


for (int lod = 0; lod < lods; lod++)
{
   for (int k = 0; k <= lods; k++)
   {
      x -= (((xCameraTile >> k) & 1)) << k;
      z -= (((zCameraTile >> k) & 1)) << k;
   }
}

If there would be a direct formula for that one… I’d be thrilled, but I wouldn’t really need it :slight_smile:

I create this kind of black-magic code (for me at least) by writing out the LOD-math for a few levels,
then searching for patterns, transforming it into formulas, where the formula’s don’t make much
sense to me, to be honest. In the documentation I write how I created them.

I just don’t have the time to examin what really happens. Not really interested either :stuck_out_tongue:

Great. Now for your next challenge.
Could you tell me the next 7 numbers in this sequence… http://www.lottery.co.uk/euro-millions.htm :smiley:

4, 8, 15, 16, 23, 42 and the age of your imaginairy friend.

LOL. Thanks. If I win, you can have my Oceanic flight tickets to Los Angeles. ;D

Oh god…not Lost! Its haunting me to this day…

* darkprophet closes ears and runs shouting BLAH BLAH BLAH BLAH BLAH BLAH BLAH