(38G) OEIS A262389: Last Digit Composite - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (38G) OEIS A262389: Last Digit Composite (/thread-9008.html) |
(38G) OEIS A262389: Last Digit Composite - Gerald H - 09-08-2017 05:45 AM The programme inserts symbolics in the Sequence App to produce the sequence of numbers having right-most digit composite. For more info please see https://oeis.org/A262389 Code: RECURSE(U,U2(N-2),4,6)►U1(N): RE: (38G) OEIS A262389: Last Digit Composite - Gerald H - 09-13-2017 02:06 PM The 3 recursions can be telescoped into one, producing a faster method of generating the series. Code: RECURSE(U,IFTE(N>5,U1(N-1)+U1(N-4)-U1(N-5),IFTE(N==5,14,IFTE(N==4,9,8))),4,6)►U1(N): Although I find the first version more pretty. RE: (38G) OEIS A262389: Last Digit Composite - Didier Lachieze - 09-13-2017 04:06 PM Here is a direct formula tested on the Prime as I don't have a 38G: Code: U(N)=10*IP((N-1)/4)+2*(N MOD 4)+7*NOT(N MOD 4)+2 RE: (38G) OEIS A262389: Last Digit Composite - Gerald H - 09-13-2017 06:09 PM Bravo Didier! On 38G you must have brackets around (NOT(N MOD 4)) then it works OK. I tried a formula, but yours beats mine. Here's mine: Code: RECURSE(U,(5*N+1-U2(N)+(3+U2(N))*U2((2*N-3-U2(N))/4)/2)/2,4,6)►U1(N): just for the record. RE: (38G) OEIS A262389: Last Digit Composite - Gerald H - 09-14-2017 06:25 AM Explicitly, this is what Didier's formula should look like on the 38G: Code: RECURSE(U,(10*INT((N-1)/4)+2*(N MOD 4)+7*NOT N MOD 4)+2 RE: (38G) OEIS A262389: Last Digit Composite - Gerald H - 09-14-2017 06:45 AM Didier, perhaps you should inform OEIS of your formula, as it's more elegant than any on their webpage. |