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.

A111240 Index at which n-th prime appears in A109890.

This page as a plain text file.
%I A111240 #14 Apr 26 2024 12:06:35
%S A111240 2,3,9,23,40,22,67,49,43,48,58,89,76,151,98,24,44,59,185,100,271,122,
%T A111240 207,178,84,217,130,31,88,145,357,119,138,309,123,47,590,150,334,684,
%U A111240 245,39,139,81,66,70,253,642,737,227,50,144,131,422,496,479,516,389,715
%N A111240 Index at which n-th prime appears in A109890.
%H A111240 Michael De Vlieger, <a href="/A111240/b111240.txt">Table of n, a(n) for n = 1..1262</a>
%e A111240 The 4th prime, 7, is A109890(23), so a(4) = 23.
%p A111240 A109890 := proc(nmin) local a,i,k,apsum; a := [1] ; apsum := 1 ; while nops(a) < nmin do k := 1; while k in a or not ( apsum mod k = 0 or k mod apsum = 0 ) do k := k+1 ; od ; a := [op(a),k] ; apsum := apsum+k ; od; RETURN(a) ; end: A111240 := proc(nmin) local a,a109890,n,i; a := [] ; a109890 := A109890(nmin) ; n := 1; while member( ithprime(n),a109890,'i') do a := [op(a),i] ; n := n+1 ; od; RETURN(a) ; end: A111240(560) ; # _R. J. Mathar_, Aug 20 2007
%t A111240 nn = 1000; c[_] := False; p[_] := 0;
%t A111240 Array[Set[{a[#], c[#]}, {#, True}] &, 2];
%t A111240 r = 0; s = a[1] + a[2]; p[2] = 2;
%t A111240 Monitor[Do[k = SelectFirst[Divisors[s], ! c[#] &];
%t A111240   c[k] = True;
%t A111240   Map[(If[p[#] == 0, Set[p[#], n]]; If[# > r, r = #]) &,
%t A111240     FactorInteger[k][[All, 1]]];
%t A111240   s += k, {n, 3, nn}], n];
%t A111240 s = 1; Reap[While[Set[k, p[Prime[s]]] > 0, Sow[k]; s++] ][[-1, 1]] (* _Michael De Vlieger_, Apr 26 2024 *)
%Y A111240 Cf. A000040, A000720, A109890.
%K A111240 nonn
%O A111240 1,1
%A A111240 _N. J. A. Sloane_, Oct 30 2005
%E A111240 More terms from _R. J. Mathar_, Aug 20 2007
%E A111240 More terms from _David Wasserman_, Jan 07 2009