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.

A386963 Gaps between positions of odd terms in A065090.

This page as a plain text file.
%I A386963 #52 Aug 29 2025 11:42:23
%S A386963 5,4,4,3,2,4,2,3,4,3,2,3,2,4,2,3,4,2,3,3,2,3,2,2,3,4,4,3,2,2,2,2,2,3,
%T A386963 3,2,4,2,2,2,4,2,3,2,3,3,2,3,2,4,2,2,2,4,4,2,2,2,2,3,2,2,2,2,3,4,3,2,
%U A386963 4,2,2,2,3,2,3,2,3,2,4,2,3,4,2,2,2,3,2,2,2,2,2,3,4,3,2,2,2,2,2,3,2
%N A386963 Gaps between positions of odd terms in A065090.
%C A386963 For n >= 2 we have a(n) in {2,3,4}:
%C A386963   a(n) = 2 if no prime lies between the two successive odd terms,
%C A386963   a(n) = 3 if a single prime lies between them,
%C A386963   a(n) = 4 if two primes lie between them.
%C A386963 The initial 5 comes from 3, 5, 7 between 1 and 9.
%C A386963 Conjecture: a(n) tends to 2 in frequency (i.e., {n : a(n) = 2} has natural density 1).
%C A386963 Conjecture is true because the primes have natural density 0. - _Robert Israel_, Aug 29 2025
%e A386963 A065090: 1, 2, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, ...
%e A386963 Odd terms occur at positions: 1, 6, 10, 14, 17, 19, 23, 25, ...
%e A386963 Hence a(n): 5, 4, 4, 3, 2, 4, 2, ...
%t A386963 a065090=Select[Range[335],#==2||!PrimeQ[#]&];l=Length[a065090];p={};Do[If[OddQ[a065090[[i]] ],AppendTo[p,i]],{i,l}];Differences[p] (* _James C. McMahon_, Aug 29 2025 *)
%o A386963 (Python)
%o A386963 from sympy import isprime
%o A386963 def gaps_generator():
%o A386963     pos = 0
%o A386963     last = None
%o A386963     k = 1
%o A386963     while True:
%o A386963         if not (k % 2 == 1 and isprime(k)):  # in A065090
%o A386963             pos += 1
%o A386963             if k % 2 == 1:  # odd term (A014076)
%o A386963                 if last is None:
%o A386963                     last = pos
%o A386963                 else:
%o A386963                     yield pos - last
%o A386963                     last = pos
%o A386963         k += 1
%o A386963 def a(n: int) -> int:
%o A386963     g = gaps_generator()
%o A386963     for _ in range(n - 1):
%o A386963         next(g)
%o A386963     return next(g)
%o A386963 (PARI) lista(nn) = my(vio = select(x->(x % 2), select(m->(!isprime(m) || m==2), [1..nn]), 1)); vector(#vio-1, k, vio[k+1] - vio[k]); \\ _Michel Marcus_, Aug 16 2025
%Y A386963 Cf. A065090, A014076.
%K A386963 nonn,easy,new
%O A386963 1,1
%A A386963 _Aied Sulaiman_, Aug 11 2025