login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A309367 The number of lucky numbers between two consecutive primes, bounds excluded. 2

%I #38 May 14 2023 04:13:45

%S 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,

%T 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,

%U 0,0,1,1,0,0,0,1,2,1,0,1,0,2,0,0,0,0,1

%N The number of lucky numbers between two consecutive primes, bounds excluded.

%H Amiram Eldar, <a href="/A309367/b309367.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = 0 because between the first two primes (2,3) there are no lucky numbers.

%e a(4) = 1 because between 7 and 1 there is one lucky number (9).

%e a(15) = 2 because between 47 and 53 there are two lucky numbers (49, 51).

%p # uses[A000959List]

%p A309367List := proc(mx) local L, j;

%p L := convert(A000959List(ithprime(mx)), set):

%p j := n -> {seq(k, k = [$ithprime(n)+1..ithprime(n+1)-1])}:

%p seq(nops(j(n) intersect L), n = 1..mx) end:

%p A309367List(87); # _Peter Luschny_, Mar 27 2020

%o (Sage) # uses[lucky from A000959]

%o def lucky_range(a, b):

%o return [l for l in lucky(b) if a <= l < b]

%o P = prime_range(250)

%o [len(lucky_range(P[i]+1, P[i+1])) for i in range(len(P)-1)]

%Y Cf. A000040, A000959, A309365.

%K nonn

%O 1,15

%A _Hauke Löffler_, Jul 25 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 11:31 EDT 2024. Contains 371792 sequences. (Running on oeis4.)