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.

A079848 Smallest primes such that a(j) - a(k) are all different.

This page as a plain text file.
%I A079848 #23 Sep 11 2023 16:42:18
%S A079848 2,3,5,11,23,37,47,97,101,149,211,233,353,383,487,641,757,797,919,
%T A079848 1097,1163,1381,1409,1481,1777,1997,2287,2417,2969,3049,3371,3529,
%U A079848 3929,4231,4759,5279,5449,5717,5953,6529,6983,7583,8053,8819,9043,10133,10799
%N A079848 Smallest primes such that a(j) - a(k) are all different.
%C A079848 This is the slowest-growing prime B2 sequence. See A005282. - _T. D. Noe_, Mar 24 2007
%H A079848 T. D. Noe, <a href="/A079848/b079848.txt">Table of n, a(n) for n=1..4084</a> (terms less than 2*10^9)
%t A079848 terms = 100; a = Table[0, {terms}]; s={}; k=0; A079848list = Reap[For[p=2, p < 10^5, p = NextPrime[p], j=1; While[j <= k && FreeQ[s, p-a[[j]]], j++]; If[j>k, For[j=1, j <= k, j++, s = Union[s, {p-a[[j]]}]]; k++; a[[k]] = p; Print[p]; Sow[p]; If[k == terms, Break[]]]]][[2, 1]]; (* _Jean-François Alcover_, Nov 02 2016, adapted from _Max Alekseyev_'s PARI code *)
%o A079848 (PARI) a=vector(100);s=Set();k=0;forprime(p=2,10^5,j=1;while(j<=k&&!setsearch(s,p-a[j]),j++);if(j>k, for(j=1,k,s=setunion(s,[p-a[j]]));k++;a[k]=p;print1(" ",p);if(k==100,break))) \\ _Max Alekseyev_, Feb 14 2005
%o A079848 (Python)
%o A079848 from itertools import count, islice
%o A079848 from sympy import nextprime
%o A079848 def A079848_gen(): # generator of terms
%o A079848     aset2, alist, k = set(), [], 0
%o A079848     while (k:=nextprime(k)):
%o A079848         bset2 = set()
%o A079848         for a in alist:
%o A079848             if (b:=k-a) in aset2:
%o A079848                 break
%o A079848             bset2.add(b)
%o A079848         else:
%o A079848             yield k
%o A079848             alist.append(k)
%o A079848             aset2.update(bset2)
%o A079848 A079848_list = list(islice(A079848_gen(),30)) # _Chai Wah Wu_, Sep 11 2023
%Y A079848 Cf. A079849.
%K A079848 nice,nonn
%O A079848 1,1
%A A079848 _Amarnath Murthy_, Feb 18 2003
%E A079848 More terms from _Max Alekseyev_, Feb 14 2005