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.
%I A217916 #13 Aug 31 2013 13:24:25 %S A217916 2,1,4,2,5,6,4,4,9,12,2,10,8,11,16,6,8,12,14,15,18,6,10,14,20,18,17, %T A217916 22,2,10,24,18,26,20,27,24,6,8,14,30,24,28,30,29,28,2,18,20,18,32,28, %U A217916 34,32,39,34,6,8,20,26,22,34,38,48,36,41,38,14,12,18,22,30 %N A217916 a(n) = prime(n) - Sum_{k=1..A002024(n)-1} a(n-k), where A002024(m) = [sqrt(2*m)+1/2] is "n appears n times". %C A217916 Form this sequence into a number triangle, then it seems that: %C A217916 (1) the odd numbers only appear adjacent to the main diagonal; %C A217916 (2) the number 2 only appears in column 1. %H A217916 Paul D. Hanna, <a href="/A217916/b217916.txt">Table of n, a(n) for n = 1..10011</a> %F A217916 Row sums equal A011756(n) = prime(n(n+1)/2). %e A217916 Start with a(1) = 2, from then on, the sum of A002024(n) consecutive terms prior to and including a(n) generates the n-th prime number %e A217916 (A002024 begins: [1, 2,2, 3,3,3, 4,4,4,4, 5,5,5,5,5, ...]). %e A217916 n=1: 2 = 2; (start) %e A217916 n=2: 3 = 2 + 1; (sum of 2 terms = prime) %e A217916 n=3: 5 = 1 + 4; " %e A217916 n=4: 7 = 1 + 4 + 2; (sum of 3 terms = prime) %e A217916 n=5: 11 = 4 + 2 + 5; " %e A217916 n=6: 13 = 2 + 5 + 6; " %e A217916 n=7: 17 = 2 + 5 + 6 + 4; (sum of 4 terms = prime) %e A217916 n=8: 19 = 5 + 6 + 4 + 4; " %e A217916 n=9: 23 = 6 + 4 + 4 + 9; " %e A217916 n=10: 29 = 4 + 4 + 9 + 12; " %e A217916 n=11: 31 = 4 + 4 + 9 + 12 + 2; (sum of 5 terms = prime) %e A217916 ... %e A217916 As a triangle, the sequence begins: %e A217916 2; %e A217916 1, 4; %e A217916 2, 5, 6; %e A217916 4, 4, 9, 12; %e A217916 2, 10, 8, 11, 16; %e A217916 6, 8, 12, 14, 15, 18; %e A217916 6, 10, 14, 20, 18, 17, 22; %e A217916 2, 10, 24, 18, 26, 20, 27, 24; %e A217916 6, 8, 14, 30, 24, 28, 30, 29, 28; %e A217916 2, 18, 20, 18, 32, 28, 34, 32, 39, 34; %e A217916 6, 8, 20, 26, 22, 34, 38, 48, 36, 41, 38; %e A217916 14, 12, 18, 22, 30, 28, 42, 44, 54, 40, 47, 46; %e A217916 4, 22, 22, 20, 32, 32, 34, 46, 50, 62, 44, 49, 50; %e A217916 12, 12, 26, 30, 24, 38, 44, 36, 64, 56, 72, 50, 55, 52; %e A217916 6, 22, 18, 32, 32, 30, 44, 48, 38, 76, 66, 74, 54, 61, 58; %e A217916 2, 18, 26, 24, 40, 42, 38, 54, 56, 44, 82, 70, 82, 60, 65, 66; %e A217916 4, 16, 28, 38, 26, 50, 44, 42, 56, 66, 58, 86, 72, 86, 74, 69, 68; %e A217916 4, 24, 20, 36, 48, 34, 54, 50, 48, 70, 70, 64, 92, 80, 92, 86, 73, 74; %e A217916 2, 14, 26, 26, 46, 50, 44, 56, 56, 66, 74, 72, 68, 98, 86, 100, 92, 79, 96; %e A217916 2, 12, 22, 36, 32, 52, 58, 56, 60, 62, 72, 76, 78, 80, 108, 104, 102, 96, 85, 98; ... %e A217916 Notice the positions of the odd numbers and of the number 2; %e A217916 the only odd numbers appear adjacent to the main diagonal and %e A217916 the number 2 only appears in the first column. %o A217916 (PARI) /* Using the recurrence (slow) */ %o A217916 {a(n)=if(n<1,0,if(n==1,2,prime(n)-sum(k=1,floor(1/2+sqrt(2*n))-1,a(n-k))))} %o A217916 for(n=1,120,print1(a(n),", ")) %o A217916 (PARI) /* Print as a Triangle of M Rows (much faster) */ %o A217916 {M=20;A=vector(M*(M+1)/2);} %o A217916 {a(n)=A[n]=if(n<1,0,if(n==1,2,prime(n)-sum(k=1,floor(1/2+sqrt(2*n))-1,A[n-k])))} %o A217916 for(n=1,M,for(k=1,n,print1(a(n*(n-1)/2+k),", "));print("")) %Y A217916 Cf. A011756, A217917 (odd numbers that appear), A217918 (positions of 2), A217919 (rows in which 2 appears), A217920 (column 1). %K A217916 nonn %O A217916 1,1 %A A217916 _Paul D. Hanna_, Mar 04 2013