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.

A065936 a(n) is the integer (reduced squarefree) under the square root obtained when the inverse of a variant of Minkowski's question mark function is applied to the n-th ratio A007305(n+1)/A007306(n+1) in the left-hand subtree of Stern-Brocot tree and zero when it results a rational value.

This page as a plain text file.
%I A065936 #27 Feb 16 2025 08:32:45
%S A065936 0,5,5,0,2,2,0,2,3,0,3,3,0,3,2,5,13,17,2,17,37,5,13,13,5,37,17,2,17,
%T A065936 13,5,3,17,3,37,21,13,10,37,3,401,6,13,10,401,0,17,17,0,401,10,13,6,
%U A065936 401,3,37,10,13,21,37,3,17,3,0,37,10,0,401,506,17,5,401,37,21610,730,5,1373
%N A065936 a(n) is the integer (reduced squarefree) under the square root obtained when the inverse of a variant of Minkowski's question mark function is applied to the n-th ratio A007305(n+1)/A007306(n+1) in the left-hand subtree of Stern-Brocot tree and zero when it results a rational value.
%C A065936 Note: the underlying function N2Qv (see the Maple code) maps natural numbers 1, 2, 3, 4, 5, ..., through all the positive rationals in the open range (0,1): 1/2, 1/3, 2/3, 1/4, 2/5, 3/5, ... bijectively to the union of positive rationals and quadratic surds. A065937 gives similar mapping involving the inverse of the standard Minkowski's question mark function.
%C A065936 Note the symmetry of rows 0; 5,5; 0,2,2,0; 2,3,0,3,3,0,3,2; 5,13,17,2,17,37,5,13,13,5,37,17,2,17,13,5; ... emanating from the symmetry present in A007306.
%H A065936 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/QuadraticIrrationalNumber.html">Quadratic Irrational Number</a>.
%H A065936 <a href="/index/Me#MinkowskiQ">Index entries for sequences related to Minkowski's question mark function</a>
%H A065936 <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a>
%e A065936 The first few values for this mapping are N2Qv(1) = 1, N2Qv(2) = (sqrt(5)-1)/2, N2Qv(3) = (sqrt(5)+1)/2, N2Qv(4) = 1/2, N2Qv(5) = sqrt(2)/2, N2Qv(6) = sqrt(2), N2Qv(7) = 2, N2Qv(8) = sqrt(2)-1
%p A065936 [seq(find_sqrt(N2Qv(j)),j=1..512)];
%p A065936 N2Qv := proc(n) local m; m := n + 2^floor_log_2(n); Inverse_of_Variant_of_MinkowskisQMark(A007305(m+1)/A047679(m-1)); end;
%p A065936 Inverse_of_Variant_of_MinkowskisQMark := proc(r) local x,y,b,d,k,s,i,q; x := numer(r); y := denom(r); if(y = 2*x) then RETURN(1); fi; b := []; d := []; k := 0; s := 0; i := 0; while(x <> 0) do q := floor(x/y); if(i > 0) then b := [op(b),q]; d := [op(d),x]; fi; x := 2*(x-(q*y)); if(member(x,d,'k') and (k > 1) and (b[k] <> b[k-1]) and (q <> floor(x/y))) then s := eval_periodic_confrac_tail(list2runcounts(b[k..nops(b)])); b := b[1..(k-1)]; break; fi; i := i+1; od; if(0 = k) then b := b[1..(nops(b)-1)]; b := [op(b),b[nops(b)]]; fi; if(r < (1/2)) then RETURN(factor(eval_confrac([0,op(list2runcounts(b))],s))); else RETURN(factor(eval_confrac(list2runcounts(b),s))); fi; end;
%p A065936 eval_confrac := proc(c,z) local x,i; x := z; for i in reverse(c) do x := (`if`((0=x),x,(1/x)))+i; od; RETURN(x); end;
%p A065936 eval_periodic_confrac_tail := proc(c) local x,i,u,r; x := (eval_confrac(c,u) - u) = 0; r := [solve(x,u)]; RETURN(max(r[1],r[2])); end;
%p A065936 list2runcounts := proc(b) local a,p,y,c; if(0 = nops(b)) then RETURN([]); fi; a := []; c := 0; p := b[1]; for y in b do if(y <> p) then a := [op(a),c]; c := 0; p := y; fi; c := c+1; od; RETURN([op(a),c]); end;
%p A065936 find_sqrt := proc(x) local n,i,y; n := nops(x); if(n < 2) then RETURN(0); fi; if((2 = n) and (`^` = op(0,x)) and (1/2 = op(2,x))) then RETURN(op(1,x)); else for i from 0 to n do y := find_sqrt(op(i,x)); if(y <> 0) then RETURN(y); fi; od; RETURN(0); fi; end;
%Y A065936 a(n) = A065937(A065934(n)). Positions of the zeros are given by A065810. Positions of sqrt(n) in this mapping: A065938.
%K A065936 nonn
%O A065936 1,2
%A A065936 _Antti Karttunen_, Dec 07 2001
%E A065936 Description clarified by _Antti Karttunen_, Aug 26 2006