The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A309311 a(1)=1, a(2)=2; thereafter a(n+1) = Sum_{i=m..n} a(i) where m = (n+1)-k and k is the last digit of a(n), except if k=0, k=1, or k>n then a(n+1) = Sum_{i=1..n} a(i). 1

%I #18 Sep 01 2019 22:06:30

%S 1,2,3,6,12,18,42,60,144,264,510,1062,1572,2634,5778,12024,22008,

%T 45852,67860,159852,227712,387564,842988,1765860,3543828,7041516,

%U 13809468,27778788,55397724,104027496,211598820,426741468,849939108,1696334388,3385627260,6785383692

%N a(1)=1, a(2)=2; thereafter a(n+1) = Sum_{i=m..n} a(i) where m = (n+1)-k and k is the last digit of a(n), except if k=0, k=1, or k>n then a(n+1) = Sum_{i=1..n} a(i).

%C Briefly, a(n+1) is the sum of the previous terms up to a number m which is defined by the last digit of a(n).

%H Robert Israel, <a href="/A309311/b309311.txt">Table of n, a(n) for n = 1..3550</a>

%e Calculating a(8):

%e 8=n+1, n=7

%e a(7)=42 so k=2

%e m=n+1-k=6

%e a(8)=Sum_{i=6..7} a(i)=a(6)+a(7)

%e a(8)=60

%p A[1]:= 1: S[0]:= 0: S[1]:= 1:

%p A[2]:= 2: S[2]:= 3:

%p for n from 2 to 99 do

%p k:= A[n] mod 10;

%p if k <= 1 or k > n then A[n+1]:= S[n] else A[n+1]:= S[n] - S[n-k] fi;

%p S[n+1]:= S[n]+A[n+1]

%p od:

%p seq(A[i],i=1..100); # _Robert Israel_, Sep 01 2019

%t a[1] = 1; a[2] = 2; a[n_] := a[n] = Module[{k = Mod[a[n - 1], 10]}, m = If[k > n - 1 || k == 0, 1, n - k]; Sum[a[i], {i, m, n - 1}]]; Array[a, 36] (* _Amiram Eldar_, Jul 23 2019 *)

%K nonn,base,easy

%O 1,2

%A _Eder Vanzei_, Jul 22 2019

%E More terms from _Amiram Eldar_, Jul 23 2019

%E Edited by _N. J. A. Sloane_, Aug 31 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 17 00:45 EDT 2024. Contains 372555 sequences. (Running on oeis4.)