(38G) OEIS A262389: Last Digit Composite
09-08-2017, 05:45 AM (This post was last modified: 09-10-2017 11:33 AM by Gerald H.)
Post: #1
 Gerald H Senior Member Posts: 1,457 Joined: May 2014
(38G) OEIS A262389: Last Digit Composite
The programme inserts symbolics in the Sequence App to produce the sequence of numbers having right-most digit composite.

https://oeis.org/A262389

Code:
RECURSE(U,U2(N-2),4,6)►U1(N): CHECK 1: RECURSE(U,U3(N-2),8,9)►U2(N): RECURSE(U,U3(N-1)+U2(N-2)-U1(N-1),14,16)►U3(N):
09-13-2017, 02:06 PM
Post: #2
 Gerald H Senior Member Posts: 1,457 Joined: May 2014
RE: (38G) OEIS A262389: Last Digit Composite
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): CHECK 1:

Although I find the first version more pretty.
09-13-2017, 04:06 PM (This post was last modified: 09-13-2017 04:07 PM by Didier Lachieze.)
Post: #3
 Didier Lachieze Senior Member Posts: 1,286 Joined: Dec 2013
RE: (38G) OEIS A262389: Last Digit Composite
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
09-13-2017, 06:09 PM (This post was last modified: 09-14-2017 05:37 AM by Gerald H.)
Post: #4
 Gerald H Senior Member Posts: 1,457 Joined: May 2014
RE: (38G) OEIS A262389: Last Digit Composite
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): CHECK 1: RECURSE(U,IFTE(N MOD 2,-1,1),-1,1)►U2(N):

just for the record.
09-14-2017, 06:25 AM
Post: #5
 Gerald H Senior Member Posts: 1,457 Joined: May 2014
RE: (38G) OEIS A262389: Last Digit Composite
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 ,4,6) ►U1(N): CHECK 1:
09-14-2017, 06:45 AM
Post: #6
 Gerald H Senior Member Posts: 1,457 Joined: May 2014
RE: (38G) OEIS A262389: Last Digit Composite
Didier, perhaps you should inform OEIS of your formula, as it's more elegant than any on their webpage.
 « Next Oldest | Next Newest »

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