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.

A380130 For n >= 2, let b(n) = 1 if A379784(n) is 3 mod 4, 0 if A379784(n) is 1 mod 4; form the RUNS transform of {b(n), n >= 2}.

This page as a plain text file.
%I A380130 #19 Jan 13 2025 11:32:05
%S A380130 1,6,13,34,87,229,581,1591,4268,11637,31944,88526,246105,688982,
%T A380130 1936129,5463517,15470445
%N A380130 For n >= 2, let b(n) = 1 if A379784(n) is 3 mod 4, 0 if A379784(n) is 1 mod 4; form the RUNS transform of {b(n), n >= 2}.
%e A380130 A379784 begins 1, 5, 3, 7, 11, 19, 23, 31, 13, 17, 29, 37, ..., and the {b(n), n >= 2} sequence begins 0, 1, 1, 1, 1, 1, 1, 0, ..., whose RUNS transform is 1, 6, ...
%t A380130 nn = 2^19; c[_] := True; q = 0; j = r = 1; s = 4;
%t A380130 Monitor[Rest@ Reap[Do[m = j + s;
%t A380130   While[Set[k, SelectFirst[FactorInteger[m][[All, 1]], c]];
%t A380130     ! IntegerQ[k], m += s];
%t A380130   c[k] = False; j = k;
%t A380130   If[# == r, q++, r = #; Sow[q]; q = 1] &[(Mod[k, 4] - 1)/2],
%t A380130 {n, nn}] ][[-1, 1]], n] (* _Michael De Vlieger_, Jan 13 2025 *)
%o A380130 (Python)
%o A380130 from sympy import primefactors
%o A380130 prev_a379784 = 1
%o A380130 prev_b = -1
%o A380130 b_run = 0
%o A380130 a379784_set = set([prev_a379784])
%o A380130 seq = []
%o A380130 max_seq_len = 17
%o A380130 while len(seq) < max_seq_len:
%o A380130     c = prev_a379784
%o A380130     done = False
%o A380130     while not done:
%o A380130         c = c + 4
%o A380130         factors = primefactors(c)
%o A380130         for factor in factors:
%o A380130             if factor not in a379784_set:
%o A380130                 a379784_set.add(factor)
%o A380130                 if factor % 4 == 3:
%o A380130                     b = 1
%o A380130                 else:
%o A380130                     b = 0
%o A380130                 if prev_b >= 0:
%o A380130                     if b == prev_b:
%o A380130                         b_run += 1
%o A380130                     else:
%o A380130                         seq.append(b_run)
%o A380130                         b_run = 1
%o A380130                 else:
%o A380130                     b_run = 1
%o A380130                 prev_b = b
%o A380130                 prev_a379784 = factor
%o A380130                 done = True
%o A380130                 break
%o A380130 print(seq)
%Y A380130 Cf. A091237, A379783, A379784.
%Y A380130 See also A379652, A379785.
%K A380130 nonn,more
%O A380130 1,2
%A A380130 _Robert C. Lyons_, Jan 12 2025