Thursday, January 23, 2014

A few good chemical engineers.

Son, we live in a world that has chemicals, and those chemicals have to be stored in un-inspected, leaky tanks. Who's gonna do it? You? The EPA? I have a greater responsibility than you could possibly fathom. You weep for Charleston, WV, and you curse the corporations. You have that luxury. You have the luxury of not knowing what I know. That Charleston, WV's death, while tragic, probably saved lives. And my existence, while grotesque and incomprehensible to you, saves lives. You don't want the truth because deep down in places you don't talk about at parties, you want me on that tank, you need me on that tank. We use words like honor, code, loyalty. We use these words as the backbone of a life spent defending capitalism. You use them as a punchline. I have neither the time nor the inclination to explain myself to a man who rises and sleeps under the blanket of the very products that I provide, and then questions the manner in which I provide it. I would rather you just said thank you, and went on your way, Otherwise, I suggest you start a company, and show me how to store chemicals. Either way, I don't give a damn what you think you are entitled to.

Monday, January 20, 2014

two consecutive numbers in an additive series plus an offset is equal to the larger numbers n value plus one to the size of the series.

Figured out the relationship between two consecutive numbers in a series and the next larger series.  It has to do with multiples of the triangular numbers.

https://github.com/BuckRogers1965/Examples/blob/master/Math/additiveSeries/additiveSeries-Relationships.c

As you can see in the following example program:
 #include <stdio.h>


 int main () {


   int i, j, n, x;

   for (x=1; x<20; x++) {
     printf("\tFor additive series of size %d\n", x);
     printf("\tn\tadd\tseries\tformula\t\tnext\tf(n-1)\tf(n)\toffset\n");
     for (i = 1, j = 0, n =1 ; n<10; n++, i+=x ){
       j+=i;
       printf("\t%d\t%d\t%d\t%d\t\t%d\t%d\t%d\t%d\n", n, i, j, (x*n*n-(x-2)*n)/2,
       (x*(n-1)*(n-1)-(x-2)*(n-1))/2 + (x*n*n-(x-2)*n)/2 +(-x*n*n +3*x*n +n*n -3*n -2*x +2)/2,
       (x*(n-1)*(n-1)-(x-2)*(n-1))/2, (x*n*n-(x-2)*n)/2, (-x*n*n +3*x*n +n*n -3*n -2*x +2)/2 );
     }
     printf("\n\n");
   }

 }




 For additive series of size 1
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 2 3 3  4 1 3 0
 3 3 6 6  9 3 6 0
 4 4 10 10  16 6 10 0
 5 5 15 15  25 10 15 0
 6 6 21 21  36 15 21 0
 7 7 28 28  49 21 28 0
 8 8 36 36  64 28 36 0
 9 9 45 45  81 36 45 0


 For additive series of size 2
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 3 4 4  5 1 4 0
 3 5 9 9  12 4 9 -1
 4 7 16 16  22 9 16 -3
 5 9 25 25  35 16 25 -6
 6 11 36 36  51 25 36 -10
 7 13 49 49  70 36 49 -15
 8 15 64 64  92 49 64 -21
 9 17 81 81  117 64 81 -28


 For additive series of size 3
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 4 5 5  6 1 5 0
 3 7 12 12  15 5 12 -2
 4 10 22 22  28 12 22 -6
 5 13 35 35  45 22 35 -12
 6 16 51 51  66 35 51 -20
 7 19 70 70  91 51 70 -30
 8 22 92 92  120 70 92 -42
 9 25 117 117  153 92 117 -56


 For additive series of size 4
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 5 6 6  7 1 6 0
 3 9 15 15  18 6 15 -3
 4 13 28 28  34 15 28 -9
 5 17 45 45  55 28 45 -18
 6 21 66 66  81 45 66 -30
 7 25 91 91  112 66 91 -45
 8 29 120 120  148 91 120 -63
 9 33 153 153  189 120 153 -84


 For additive series of size 5
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 6 7 7  8 1 7 0
 3 11 18 18  21 7 18 -4
 4 16 34 34  40 18 34 -12
 5 21 55 55  65 34 55 -24
 6 26 81 81  96 55 81 -40
 7 31 112 112  133 81 112 -60
 8 36 148 148  176 112 148 -84
 9 41 189 189  225 148 189 -112


 For additive series of size 6
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 7 8 8  9 1 8 0
 3 13 21 21  24 8 21 -5
 4 19 40 40  46 21 40 -15
 5 25 65 65  75 40 65 -30
 6 31 96 96  111 65 96 -50
 7 37 133 133  154 96 133 -75
 8 43 176 176  204 133 176 -105
 9 49 225 225  261 176 225 -140


 For additive series of size 7
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 8 9 9  10 1 9 0
 3 15 24 24  27 9 24 -6
 4 22 46 46  52 24 46 -18
 5 29 75 75  85 46 75 -36
 6 36 111 111  126 75 111 -60
 7 43 154 154  175 111 154 -90
 8 50 204 204  232 154 204 -126
 9 57 261 261  297 204 261 -168


 For additive series of size 8
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 9 10 10  11 1 10 0
 3 17 27 27  30 10 27 -7
 4 25 52 52  58 27 52 -21
 5 33 85 85  95 52 85 -42
 6 41 126 126  141 85 126 -70
 7 49 175 175  196 126 175 -105
 8 57 232 232  260 175 232 -147
 9 65 297 297  333 232 297 -196


 For additive series of size 9
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 10 11 11  12 1 11 0
 3 19 30 30  33 11 30 -8
 4 28 58 58  64 30 58 -24
 5 37 95 95  105 58 95 -48
 6 46 141 141  156 95 141 -80
 7 55 196 196  217 141 196 -120
 8 64 260 260  288 196 260 -168
 9 73 333 333  369 260 333 -224


 For additive series of size 10
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 11 12 12  13 1 12 0
 3 21 33 33  36 12 33 -9
 4 31 64 64  70 33 64 -27
 5 41 105 105  115 64 105 -54
 6 51 156 156  171 105 156 -90
 7 61 217 217  238 156 217 -135
 8 71 288 288  316 217 288 -189
 9 81 369 369  405 288 369 -252


 For additive series of size 11
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 12 13 13  14 1 13 0
 3 23 36 36  39 13 36 -10
 4 34 70 70  76 36 70 -30
 5 45 115 115  125 70 115 -60
 6 56 171 171  186 115 171 -100
 7 67 238 238  259 171 238 -150
 8 78 316 316  344 238 316 -210
 9 89 405 405  441 316 405 -280


 For additive series of size 12
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 13 14 14  15 1 14 0
 3 25 39 39  42 14 39 -11
 4 37 76 76  82 39 76 -33
 5 49 125 125  135 76 125 -66
 6 61 186 186  201 125 186 -110
 7 73 259 259  280 186 259 -165
 8 85 344 344  372 259 344 -231
 9 97 441 441  477 344 441 -308


 For additive series of size 13
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 14 15 15  16 1 15 0
 3 27 42 42  45 15 42 -12
 4 40 82 82  88 42 82 -36
 5 53 135 135  145 82 135 -72
 6 66 201 201  216 135 201 -120
 7 79 280 280  301 201 280 -180
 8 92 372 372  400 280 372 -252
 9 105 477 477  513 372 477 -336


 For additive series of size 14
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 15 16 16  17 1 16 0
 3 29 45 45  48 16 45 -13
 4 43 88 88  94 45 88 -39
 5 57 145 145  155 88 145 -78
 6 71 216 216  231 145 216 -130
 7 85 301 301  322 216 301 -195
 8 99 400 400  428 301 400 -273
 9 113 513 513  549 400 513 -364


 For additive series of size 15
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 16 17 17  18 1 17 0
 3 31 48 48  51 17 48 -14
 4 46 94 94  100 48 94 -42
 5 61 155 155  165 94 155 -84
 6 76 231 231  246 155 231 -140
 7 91 322 322  343 231 322 -210
 8 106 428 428  456 322 428 -294
 9 121 549 549  585 428 549 -392


 For additive series of size 16
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 17 18 18  19 1 18 0
 3 33 51 51  54 18 51 -15
 4 49 100 100  106 51 100 -45
 5 65 165 165  175 100 165 -90
 6 81 246 246  261 165 246 -150
 7 97 343 343  364 246 343 -225
 8 113 456 456  484 343 456 -315
 9 129 585 585  621 456 585 -420


 For additive series of size 17
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 18 19 19  20 1 19 0
 3 35 54 54  57 19 54 -16
 4 52 106 106  112 54 106 -48
 5 69 175 175  185 106 175 -96
 6 86 261 261  276 175 261 -160
 7 103 364 364  385 261 364 -240
 8 120 484 484  512 364 484 -336
 9 137 621 621  657 484 621 -448


 For additive series of size 18
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 19 20 20  21 1 20 0
 3 37 57 57  60 20 57 -17
 4 55 112 112  118 57 112 -51
 5 73 185 185  195 112 185 -102
 6 91 276 276  291 185 276 -170
 7 109 385 385  406 276 385 -255
 8 127 512 512  540 385 512 -357
 9 145 657 657  693 512 657 -476


 For additive series of size 19
 n add series formula  next f(n-1) f(n) offset
 1 1 1 1  1 0 1 0
 2 20 21 21  22 1 21 0
 3 39 60 60  63 21 60 -18
 4 58 118 118  124 60 118 -54
 5 77 195 195  205 118 195 -108
 6 96 291 291  306 195 291 -180
 7 115 406 406  427 291 406 -270
 8 134 540 540  568 406 540 -378
 9 153 693 693  729 540 693 -504



Wednesday, January 15, 2014

General formula for additive series

I couldn't sleep, so instead I figured out the formulas for a whole family of additive series. (x* n ^2 - (x-2)n )/2 where x is the amount you add each time, starting with one and n is the count of the series. This is a general solution to any fixed addition series counting from one. It was really amazing when I changed the program to work with the next entry in the series and it just worked.

https://github.com/BuckRogers1965/Examples/blob/master/Math/additiveSeries/additiveSeries.c

#include <stdio.h>


int main () {


  int i, j, n, x;

  for (x=1; x<20; x++) {
    printf("for additive series of size %d\n", x);
    for (i = 1, j = 0, n =1 ; n<10; n++, i+=x ){
      j+=i;
      printf("%d  %d  %d  %d \n", n, i, j, (x*n*n-(x-2)*n)/2);
    }
    printf("\n\n");
  }

}

Output:
for additive series of size 1

1  1  1  1 

2  2  3  3 

3  3  6  6 

4  4  10  10 

5  5  15  15 

6  6  21  21 

7  7  28  28 

8  8  36  36 

9  9  45  45 





for additive series of size 2

1  1  1  1 

2  3  4  4 

3  5  9  9 

4  7  16  16 

5  9  25  25 

6  11  36  36 

7  13  49  49 

8  15  64  64 

9  17  81  81 





for additive series of size 3

1  1  1  1 

2  4  5  5 

3  7  12  12 

4  10  22  22 

5  13  35  35 

6  16  51  51 

7  19  70  70 

8  22  92  92 

9  25  117  117 





for additive series of size 4

1  1  1  1 

2  5  6  6 

3  9  15  15 

4  13  28  28 

5  17  45  45 

6  21  66  66 

7  25  91  91 

8  29  120  120 

9  33  153  153 





for additive series of size 5

1  1  1  1 

2  6  7  7 

3  11  18  18 

4  16  34  34 

5  21  55  55 

6  26  81  81 

7  31  112  112 

8  36  148  148 

9  41  189  189 





for additive series of size 6

1  1  1  1 

2  7  8  8 

3  13  21  21 

4  19  40  40 

5  25  65  65 

6  31  96  96 

7  37  133  133 

8  43  176  176 

9  49  225  225 





for additive series of size 7

1  1  1  1 

2  8  9  9 

3  15  24  24 

4  22  46  46 

5  29  75  75 

6  36  111  111 

7  43  154  154 

8  50  204  204 

9  57  261  261 





for additive series of size 8

1  1  1  1 

2  9  10  10 

3  17  27  27 

4  25  52  52 

5  33  85  85 

6  41  126  126 

7  49  175  175 

8  57  232  232 

9  65  297  297 





for additive series of size 9

1  1  1  1 

2  10  11  11 

3  19  30  30 

4  28  58  58 

5  37  95  95 

6  46  141  141 

7  55  196  196 

8  64  260  260 

9  73  333  333 





for additive series of size 10

1  1  1  1 

2  11  12  12 

3  21  33  33 

4  31  64  64 

5  41  105  105 

6  51  156  156 

7  61  217  217 

8  71  288  288 

9  81  369  369 





for additive series of size 11

1  1  1  1 

2  12  13  13 

3  23  36  36 

4  34  70  70 

5  45  115  115 

6  56  171  171 

7  67  238  238 

8  78  316  316 

9  89  405  405 





for additive series of size 12

1  1  1  1 

2  13  14  14 

3  25  39  39 

4  37  76  76 

5  49  125  125 

6  61  186  186 

7  73  259  259 

8  85  344  344 

9  97  441  441 





for additive series of size 13

1  1  1  1 

2  14  15  15 

3  27  42  42 

4  40  82  82 

5  53  135  135 

6  66  201  201 

7  79  280  280 

8  92  372  372 

9  105  477  477 





for additive series of size 14

1  1  1  1 

2  15  16  16 

3  29  45  45 

4  43  88  88 

5  57  145  145 

6  71  216  216 

7  85  301  301 

8  99  400  400 

9  113  513  513 





for additive series of size 15

1  1  1  1 

2  16  17  17 

3  31  48  48 

4  46  94  94 

5  61  155  155 

6  76  231  231 

7  91  322  322 

8  106  428  428 

9  121  549  549 





for additive series of size 16

1  1  1  1 

2  17  18  18 

3  33  51  51 

4  49  100  100 

5  65  165  165 

6  81  246  246 

7  97  343  343 

8  113  456  456 

9  129  585  585 





for additive series of size 17

1  1  1  1 

2  18  19  19 

3  35  54  54 

4  52  106  106 

5  69  175  175 

6  86  261  261 

7  103  364  364 

8  120  484  484 

9  137  621  621 





for additive series of size 18

1  1  1  1 

2  19  20  20 

3  37  57  57 

4  55  112  112 

5  73  185  185 

6  91  276  276 

7  109  385  385 

8  127  512  512 

9  145  657  657 





for additive series of size 19

1  1  1  1 

2  20  21  21 

3  39  60  60 

4  58  118  118 

5  77  195  195 

6  96  291  291 

7  115  406  406 

8  134  540  540 

9  153  693  693