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.

A255562 A reversed prime Fibonacci sequence: a(n+2) is the smallest odd prime such that a(n) is the smallest odd prime divisor of a(n+1)+a(n+2).

This page as a plain text file.
%I A255562 #57 Apr 13 2022 01:16:25
%S A255562 3,5,7,3,11,7,37,19,277,331,223,439,7,406507,67,330515394367,967,
%T A255562 10576492618777,116041,223724392248491824062507397,3691561,
%U A255562 100105207373914057144918297314160710207525630111509317,423951181
%N A255562 A reversed prime Fibonacci sequence: a(n+2) is the smallest odd prime such that a(n) is the smallest odd prime divisor of a(n+1)+a(n+2).
%C A255562 The sequence satisfies a(1) = 3, a(2) = 5, and a(n+2) is the smallest odd prime with the following property: a(n) is the smallest odd prime divisor of a(n+1)+a(n+2). It is a provably infinite sequence. It is also the "reverse" of a prime Fibonacci sequence terminating in 5,3. A prime Fibonacci sequence satisfies the following relation: a(n+2) is the smallest odd prime dividing a(n)+a(n+1), unless a(n)+a(n+1) is a power of two, in which case the sequence terminates. Prime Fibonacci sequences provably terminate, but provably can be extended indefinitely to the left.
%H A255562 J. F. Alm and T. Herald, <a href="http://arxiv.org/abs/1507.04807">A Note on Prime Fibonacci Sequences</a>, Fibonacci Quarterly 54:1 (2016), pp. 55-58. arXiv:1507.04807 [math.NT], 2015.
%o A255562 (Python)
%o A255562 import math
%o A255562 def sieve(n):
%o A255562     r = int(math.floor(math.sqrt(n)))
%o A255562     composites = [j for i in range(2,r+1) for j in range(2*i, n, i)]
%o A255562     primes = set(range(2,n)).difference(set(composites))
%o A255562     return sorted(primes)
%o A255562 Primes = sieve(1000000)
%o A255562 Odd_primes = Primes[1:]
%o A255562 def find_smallest_odd_div(n):
%o A255562     for p in Odd_primes:
%o A255562         if n % p == 0:
%o A255562             return p
%o A255562 def next_term(a,b):
%o A255562     for p in Odd_primes:
%o A255562         if (p + b) % a == 0:
%o A255562             if find_smallest_odd_div(p+b) == a:
%o A255562                 return p
%o A255562 def compute_reversed_seq(a,b):
%o A255562     seq = [a,b]
%o A255562     while seq[-1] != None:
%o A255562         seq.append(next_term(seq[-2],seq[-1]))
%o A255562     return seq[:len(seq)-1]
%o A255562 print(compute_reversed_seq(3,5))
%o A255562 (Python)
%o A255562 from sympy import isprime, factorint
%o A255562 from itertools import islice
%o A255562 def rem2(n):
%o A255562     while n%2 == 0: n //= 2
%o A255562     return n
%o A255562 def agen():
%o A255562     b, c = 3, 5
%o A255562     yield 3
%o A255562     while True:
%o A255562         yield c
%o A255562         k = (c+2)//b + 1
%o A255562         m = b*k
%o A255562         while not isprime(m-c) or min(factorint(rem2(k)), default=b+1) < b:
%o A255562             m += b
%o A255562             k += 1
%o A255562         b, c = c, m-c
%o A255562 print(list(islice(agen(), 19))) # _Michael S. Branicky_, Apr 12 2022
%o A255562 (PARI) lista(nn) = {print1(pp=3, ", "); print1(p=5, ", "); for (n=1, nn, forprime(q=3, , s = (p+q)/ 2^(valuation(p+q, 2)); if ((s!=1) && pp == factor(s)[1,1], np = q; break);); print1(np, ", "); pp = p; p = np;);} \\ _Michel Marcus_, Jul 11 2015
%Y A255562 Cf. A214674, A352955 (starting with 11,19).
%K A255562 nonn
%O A255562 1,1
%A A255562 _Jeremy F. Alm_, Jul 10 2015
%E A255562 a(16)-a(23) from _Giovanni Resta_, Jul 17 2015