Post Reply 
[VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier"
04-03-2019, 02:57 AM (This post was last modified: 04-27-2019 05:02 PM by Albert Chan.)
Post: #26
RE: [VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier"
I only have a HP-12C, which is not powerful enough to make primes, build delta tables ...

XCas code:

terms(n) := {
local c, s, p, j, k;
c := flatten(matrix(n,0)); s := 0; p := 0;
for(j:=0; j<n; j++) {
    p := nextprime(p);
    c[j] := p;
    for(k:=0; k<j; k++) c[j] := c[j] - comb(j,k) * c[k];
    s += c[j] / float(j!);
    print(p, s);
    }
}

terms(20) →

02 2.0
03 3.0
05 3.5
07 3.33333333333
11 3.45833333333
13 3.38333333333
17 3.41527777778
19 3.40476190476
23 3.4076140873
29 3.40696097884
31 3.40708691578
37 3.40706684905
41 3.4070693814
43 3.40706915834
47 3.40706916344
53 3.40706916625
59 3.40706916552
61 3.40706916564
67 3.40706916563
71 3.40706916563

Edit: replaced Python code to XCas, so HP prime user can try out.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier" - Albert Chan - 04-03-2019 02:57 AM



User(s) browsing this thread: 1 Guest(s)