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.

A381031 The second smallest prime not dividing n minus the smallest prime not dividing n.

This page as a plain text file.
%I A381031 #13 Feb 15 2025 14:29:13
%S A381031 1,2,3,2,1,2,1,2,3,4,1,2,1,2,5,2,1,2,1,4,3,2,1,2,1,2,3,2,1,4,1,2,3,2,
%T A381031 1,2,1,2,3,4,1,6,1,2,5,2,1,2,1,4,3,2,1,2,1,2,3,2,1,4,1,2,3,2,1,2,1,2,
%U A381031 3,8,1,2,1,2,5,2,1,2,1,4,3,2,1,6,1,2,3,2,1,4,1,2,3,2,1,2,1,2,3,4,1,2,1,2,9
%N A381031 The second smallest prime not dividing n minus the smallest prime not dividing n.
%H A381031 Antti Karttunen, <a href="/A381031/b381031.txt">Table of n, a(n) for n = 1..30030</a>
%F A381031 a(n) = A380539(n) - A053669(n).
%F A381031 Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A381113 - A249270 = 2.239091... . - _Amiram Eldar_, Feb 14 2025
%e A381031 For n = 1, the least prime not dividing it is 2, and the second least prime not dividing is 3, thus a(1) = 3-2 = 1.
%e A381031 For n = 3, the least nondividing prime is 2, the second least nondividing prime is 5, thus a(3) = 5-2 = 3.
%e A381031 For n = 6 = 2*3, the least nondividing prime is 5, and the second least nondividing prime is 7, thus a(6) = 7-5 = 2.
%t A381031 a[n_] := Module[{p = 1, q = 1, c = 0}, While[c < 2, p = NextPrime[p]; If[! Divisible[n, p], c++; If[c == 1, q = p]]]; p-q]; Array[a, 105] (* _Amiram Eldar_, Feb 14 2025 *)
%o A381031 (PARI) A381031(n) = { my(c=0,e=0); forprime(p=2, , if(n%p, c++; if(1==c, e=p, if(2==c, return(p-e))))); };
%Y A381031 Cf. A053669, A249270, A380539, A381113.
%K A381031 nonn
%O A381031 1,2
%A A381031 _Antti Karttunen_, Feb 12 2025