cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A113161 a(1) = 1; for n > 1, a(n) = largest prime <= a(n-1) + n - 1.

This page as a plain text file.
%I A113161 #22 Dec 15 2024 13:06:06
%S A113161 1,2,3,5,7,11,17,23,31,37,47,53,61,73,83,97,113,127,139,157,173,193,
%T A113161 211,233,257,281,307,331,359,383,409,439,467,499,523,557,593,619,653,
%U A113161 691,727,761,797,839,883,919,953,997,1039,1087,1129,1171,1223,1259,1307
%N A113161 a(1) = 1; for n > 1, a(n) = largest prime <= a(n-1) + n - 1.
%H A113161 Harvey P. Dale, <a href="/A113161/b113161.txt">Table of n, a(n) for n = 1..1000</a>
%e A113161 a(7) = 17. So a(8) = the largest prime <= 17 + 7 = 24, which is 23.
%t A113161 PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; a[1] = 1; a[n_] := a[n] = PrevPrim[a[n - 1] + n]; Array[a, 55] (* _Robert G. Wilson v_ *)
%t A113161 a[1]=1;a[n_]:=NextPrime[a[n-1]+n,-1];Table[a[n],{n,55}] (* _James C. McMahon_, Jun 16 2024 *)
%t A113161 nxt[{n_,a_}]:={n+1,If[PrimeQ[a+n],a+n,NextPrime[a+n,-1]]}; NestList[nxt,{1,1},60][[;;,2]] (* _Harvey P. Dale_, Dec 15 2024 *)
%o A113161 (PARI) {print1(a=1,",");for(n=2,55,print1(a=precprime(a+n-1),","))} \\ _Klaus Brockhaus_, Jan 06 2006
%Y A113161 Cf. A093503.
%K A113161 nonn
%O A113161 1,2
%A A113161 _Leroy Quet_, Jan 05 2006
%E A113161 More terms from _Klaus Brockhaus_ and _Robert G. Wilson v_, Jan 06 2006