login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A309367
The number of lucky numbers between two consecutive primes, bounds excluded.
2
0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 2, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 2, 0, 1, 0, 0, 1, 0, 2, 0, 0, 1, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 0, 0, 2, 1, 0, 1, 0, 0, 2, 2, 0, 0, 0, 3, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 2, 1, 0, 1, 0, 2, 0, 0, 0, 0, 1
OFFSET
1,15
LINKS
EXAMPLE
a(1) = 0 because between the first two primes (2,3) there are no lucky numbers.
a(4) = 1 because between 7 and 1 there is one lucky number (9).
a(15) = 2 because between 47 and 53 there are two lucky numbers (49, 51).
MAPLE
# uses[A000959List]
A309367List := proc(mx) local L, j;
L := convert(A000959List(ithprime(mx)), set):
j := n -> {seq(k, k = [$ithprime(n)+1..ithprime(n+1)-1])}:
seq(nops(j(n) intersect L), n = 1..mx) end:
A309367List(87); # Peter Luschny, Mar 27 2020
PROG
(Sage) # uses[lucky from A000959]
def lucky_range(a, b):
return [l for l in lucky(b) if a <= l < b]
P = prime_range(250)
[len(lucky_range(P[i]+1, P[i+1])) for i in range(len(P)-1)]
CROSSREFS
KEYWORD
nonn
AUTHOR
Hauke Löffler, Jul 25 2019
STATUS
approved