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!)
A215099 a(0)=0, a(1)=1, a(n) = least k>a(n-1) such that k+a(n-2) is prime. 2
0, 1, 2, 4, 5, 7, 8, 10, 11, 13, 18, 24, 25, 29, 34, 38, 39, 41, 44, 48, 53, 55, 56, 58, 71, 73, 78, 84, 85, 89, 94, 102, 103, 109, 120, 124, 131, 133, 138, 144, 145, 149, 162, 164, 169, 173, 178, 180, 181, 187, 192, 196, 197, 201 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
For n>0 and (n mod 4)<2, a(n) is odd.
Same definition, but k+a(n-2) is a
Fibonacci number: A006498 except first two terms,
Lucas number: A000045 except first two terms,
Pell number: A089928(n-1),
Jacobsthal number: A215095,
factorial: A215096,
square: A194274,
cube: A215097,
triangular number: A011848(n+2),
oblong number: A215098.
Example of a related sequence definition: a(0)=0, a(1)=1, a(n) = least k>a(n-1) such that k+a(n-2) is a cube.
LINKS
PROG
(Python)
# primes = [2, ..., 401]
prpr = 0
prev = 1
for n in range(77):
print prpr,
b = c = 0
while c<=prev:
c = primes[b] - prpr
b+=1
prpr = prev
prev = c
(PARI) first(n) = my(res = vector(n, i, i-1), k); for(x=3, n, k=res[x-1]+1; while(!isprime(k+res[x-2]), k++); res[x]=k); res \\ Iain Fox, Apr 22 2019 (corrected by Iain Fox, Apr 25 2019)
CROSSREFS
Cf. A062042: a(1) = 2, a(n) = least k>a(n-1) such that k+a(n-1) is a prime.
Sequence in context: A067940 A230286 A336236 * A022768 A229973 A007951
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Aug 03 2012
STATUS
approved

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 24 03:08 EDT 2024. Contains 371918 sequences. (Running on oeis4.)