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.

A125049 a(1) = 1. If a(n) is prime, a(n+1) = 2*a(n); otherwise, a(n+1) = 2*a(n) + 1.

This page as a plain text file.
%I A125049 #19 Jan 22 2023 16:30:27
%S A125049 1,3,6,13,26,53,106,213,427,855,1711,3423,6847,13695,27391,54783,
%T A125049 109567,219134,438269,876539,1753079,3506159,7012318,14024637,
%U A125049 28049275,56098551,112197103,224394207,448788415,897576831,1795153663,3590307326
%N A125049 a(1) = 1. If a(n) is prime, a(n+1) = 2*a(n); otherwise, a(n+1) = 2*a(n) + 1.
%F A125049 a(n) = floor(c*2^n), where c = 0.8359335658... - _Lorenzo Sauras Altuzarra_, Jan 01 2023
%p A125049 a := proc(n)
%p A125049    local c, k:
%p A125049    c, k := 1, 1:
%p A125049    while c < n do
%p A125049       if isprime(k) then k := 2*k: else k := 2*k+1: fi:
%p A125049       c := c+1: od:
%p A125049    k: end: # _Lorenzo Sauras Altuzarra_, Jan 02 2023
%t A125049 NestList[If[PrimeQ[#],2#,2#+1]&,1,40] (* _Harvey P. Dale_, Sep 01 2017 *)
%Y A125049 Cf. A125050.
%K A125049 nonn
%O A125049 1,2
%A A125049 _Franklin T. Adams-Watters_, Nov 17 2006