login
a(n) = prime(n)*a(n-1) - a(n-2).
1

%I #26 Oct 13 2022 13:03:02

%S 1,1,2,9,61,662,8545,144603,2738912,62850373,1819921905,56354728682,

%T 2083305039329,85359151883807,3668360225964372,172327571468441677,

%U 9129692927601444509,538479555157016784354,32838123171650422401085

%N a(n) = prime(n)*a(n-1) - a(n-2).

%H G. C. Greubel, <a href="/A146887/b146887.txt">Table of n, a(n) for n = 0..345</a>

%t seq[n_] := (v = {1, 1}; For[i = 3, i <= n, ++i, AppendTo[v, Prime[i - 1]*v[[i - 1]] - v[[i - 2]]]]; v) (* _Jon Maiga_, Nov 09 2018 *)

%o (PARI) seq(n)={my(v=vector(n)); v[1]=v[2]=1; for(n=3, n, v[n]=prime(n-1)*v[n-1] - v[n-2]); v} \\ _Andrew Howroyd_, Nov 08 2018

%o (Magma) [n le 2 select 1 else NthPrime(n-1)*Self(n-1) - Self(n-2): n in [1..30]]; // _G. C. Greubel_, Oct 12 2022

%o (SageMath)

%o @CachedFunction # a = A146887

%o def a(n): return 1 if (n<2) else nth_prime(n)*a(n-1) - a(n-2)

%o [a(n) for n in range(31)] # _G. C. Greubel_, Oct 12 2022

%K nonn,easy,less

%O 0,3

%A _Roger L. Bagula_, Nov 02 2008

%E Edited and simpler name by _Jon Maiga_ and _Andrew Howroyd_, Nov 08 2018