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.

A259019 Lexicographically first permutation of the nonnegative integers such that Sum_{k=n..2n} a(k) is a prime number, with a(1)=0.

This page as a plain text file.
%I A259019 #24 Feb 14 2018 09:59:26
%S A259019 0,2,1,4,3,5,6,11,7,9,8,13,10,15,12,16,14,23,17,20,18,25,19,21,22,31,
%T A259019 24,30,26,29,27,35,28,34,32,38,33,48,36,37,39,41,40,44,42,53,43,50,45,
%U A259019 46,47,55,49,52,51,57,54,66,56,60,58,63,59,62,61,78,64,84
%N A259019 Lexicographically first permutation of the nonnegative integers such that Sum_{k=n..2n} a(k) is a prime number, with a(1)=0.
%C A259019 Previous name: a(1)=0; for n>1, a(n) is the least number not yet used having the property that a(n) added with the next n terms is a prime number.
%C A259019 The corresponding primes are 2, 7, 13, 29, 41, 59, 79, 101, 127, 157, 191, 223, 263, 307, 347, 397, 443, 499, 557, 613, 673, 739, 809, 883, 953, 1033, 1103, 1187, 1277, 1367, 1459, 1553, 1657, 1777, ...
%C A259019 This is a permutation of the integers. - _Michel Marcus_, Jun 21 2015
%H A259019 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e A259019 a(1)= 0 plus the next single term 2 is 2 (a prime);
%e A259019 a(2)= 2 plus the next two terms (1,4) is 7 (a prime);
%e A259019 a(3)= 1 plus the next three terms (4,3,5) is 13 (a prime);
%e A259019 a(4)= 4 plus the next four terms (3,5,6,11) is 29 (a prime);
%e A259019 a(5)= 3 plus the next five terms (5,6,11,7,9) is 41 (a prime).
%p A259019 nn:=100:T:=array(1..nn):T[1]:=0:T[2]:=2:kk:=2:lst:={0,2}:
%p A259019 for n from 2 to nn do:
%p A259019   ii:=0:
%p A259019     for k from 1 to 1000 while(ii=0)do:
%p A259019      if {k} intersect lst = {}
%p A259019      then
%p A259019      ii:=1:lst:=lst union {k}:kk:=kk+1:T[kk]:=k:
%p A259019      else
%p A259019      fi:
%p A259019     od:
%p A259019      jj:=0:n0:=nops(lst):s:=sum('T[i]', 'i'=n..n0):
%p A259019       for p from 1 to 100 while(jj=0) do:
%p A259019         z:=s+p:
%p A259019          if type(z,prime)=true and {p} intersect lst={}
%p A259019          then
%p A259019          jj:=1:lst:=lst union {p}:kk:=kk+1:T[kk]:=p:
%p A259019          else
%p A259019          fi:
%p A259019        od:
%p A259019 od:
%p A259019 print(T):
%Y A259019 Cf. A000040, A247665, A259018.
%K A259019 nonn
%O A259019 1,2
%A A259019 _Michel Lagneau_, Jun 16 2015
%E A259019 Name edited by _Jon E. Schoenfield_, Sep 12 2017