Sunday, November 21, 2010

[wlktxwmi] Triangular numbers plus one

p=1:(zipWith (+) p [1..])

A compactly describable, faster than linear growing integer sequence which hits a mix of primes and composites, and which can be calculated using only addition.  Also, arbitrary elements may be computed in closed form p(i)=1+i(i+1)/2.

1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 1129 1177 1226 1276 1327 1379 1432 1486 1541 1597 1654 1712 1771 1831 1892 1954 2017 2081 2146 2212 2279 2347 2416 2486 2557 2629 2702 2776 2851 2927 3004 3082 3161 3241 3322 3404 3487 3571 3656 3742 3829 3917 4006 4096 4187 4279 4372 4466 4561 4657 4754 4852 4951

Oeis A000124

No comments :