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.

A218616 The infinite trunk of beanstalk (A179016) with reversed subsections.

This page as a plain text file.
%I A218616 #22 Nov 12 2012 18:02:31
%S A218616 0,1,3,7,4,15,11,8,31,26,23,19,16,63,57,53,49,46,42,39,35,32,127,120,
%T A218616 116,112,109,104,101,97,94,89,85,81,78,74,71,67,64,255,247,240,236,
%U A218616 231,225,221,215,209,205,200,197,193,190,184,180,176,173,168,165,161
%N A218616 The infinite trunk of beanstalk (A179016) with reversed subsections.
%C A218616 This can be viewed as an irregular table: after the initial zero on row 0, start each row n with (2^n)-1 and subtract repeatedly the number of 1-bits to get successive terms, until the number that has already been listed (which is always (2^(n-1))-1) is encountered, which is not listed second time, but instead, the current row is finished and the next row starts with (2^(n+1))-1, with the same process repeated.
%C A218616 This contains the terms in the infinite trunk of beanstalk (A179016) listed in partially reversed manner: after the initial zero each subsequence lists A213709(n) successive terms  from A179016, descending from (2^n)-1 downwards, usually down to 2^(n-1) (conjectured to indeed be a power of 2 in each case, apart from 2 itself missing from the beginning of the sequence).
%C A218616 Currently A179016 and many of the derived sequences are much easier and somewhat faster to compute with the help of this sequence, especially if the program computes any other required values incrementally in the same loop.
%H A218616 Antti Karttunen, <a href="/A218616/b218616.txt">Rows 0..16, flattened</a>
%F A218616 a(0)=0, a(1)=1, and for n > 1, if n = A213710(A213711(n)-1) then a(n) = (2^A213711(n)) - 1, and in other cases, a(n) = A011371(a(n-1)).
%F A218616 Alternatively: For n < 4, a(n) = (2^n)-1, and for n >= 4, a(n) = A004755(A004755(A011371(a(n-1)))) if A011371(a(n-1))+1 is power of 2, otherwise just A011371(a(n-1)).
%e A218616 After zero, we start with (2^1)-1 = 1, subtract A000120(1)=1 from it, resulting 1-1=0 (which is of the form (2^0)-1, thus not listed second time), instead, start the next row with (2^2)-1 = 3, subtract A000120(3)=2 from it, resulting 3-2=1, which has been already encountered, thus start the next row with (2^3)-1 = 7, subtract A000120(7)=3 from it, resulting 7-3=4, which is listed after 7, then 4-A000120(4)=4-1=3, which is of the form (2^k)-1 and already encountered, thus start the next row with (2^4)-1 = 15, etc. This results an irregular table which begins as:
%e A218616 0; 1; 3; 7, 4; 15, 11, 8; 31, 26, 23, 19, 16; 63, 57, ...
%e A218616 After zero, each row n is A213709(n-1) elements long.
%o A218616 (Scheme with memoization macro definec):
%o A218616 (definec (A218616 n) (cond ((< n 2) n) ((= (A213710 (-1+ (A213711 n))) n) (- (expt 2 (A213711 n)) 1)) (else (A011371 (A218616 (-1+ n))))))
%o A218616 ;; Somewhat simpler recursive definition added Nov 11 2012, which do not require so many auxiliary functions:
%o A218616 (definec (A218616 n) (cond ((< n 4) (-1+ (expt 2 n))) ((A011371 (A218616 (-1+ n))) => (lambda (next) (if (pow2? (1+ next)) (A004755 (A004755 next)) next)))))
%o A218616 (define (pow2? n) (and (> n 0) (zero? (A004198bi n (- n 1))))) ;; A004198 is bitwise AND
%Y A218616 a(n) = A179016(A218602(n)). The rows are the initial portions of every (2^n)-1:th row in A218254.
%K A218616 nonn,tabf
%O A218616 0,3
%A A218616 _Antti Karttunen_, Nov 10 2012