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.

Showing 1-2 of 2 results.

A238193 Position of first occurrence of (4^n - 1)/3 in A238192.

Original entry on oeis.org

3, 21, 75, 151, 1365, 5461, 14563, 87381, 184111, 932067
Offset: 2

Views

Author

T. D. Noe, Feb 21 2014

Keywords

Comments

Another version of A237661.
Is this (apart from the missing 1) the same as A054646? - R. J. Mathar, Mar 30 2014

Crossrefs

Cf. A002450 ((4^n-1)/3), A070165 (Collatz trajectories), A238192.

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; t = Table[c = Collatz[n]; co = Select[c, OddQ]; If[Length[co] == 1, 0, co[[-2]]], {n, 10000}]; Flatten[Table[Position[t, (4^n - 1)/3, 1, 1], {n, 2, 7}]]

A237660 Consider the Collatz trajectory of n; if all terms except n and 1 are even then a(n) = 0, otherwise a(n) is the last odd number before 1.

Original entry on oeis.org

0, 0, 5, 0, 0, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 21, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 85, 5, 5, 5, 5, 5, 5, 5, 5, 21, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 85
Offset: 1

Views

Author

Kival Ngaokrajang, Feb 11 2014

Keywords

Comments

Records (A002450) and indices of records (A237661) are as following:
Records: 5, 21, 85, 341, 1365, 5461, 21845, ...
Indices: 3, 42, 75, 151, 2730, 7281, 14563, ...
See A238192 and A238193 for a slightly different version. - T. D. Noe, Feb 21 2014
Differs from A238192 at n = 5, 21, 85, 341, 1365, 5461, 21845, ... (A002450 without its two initial terms). - Antti Karttunen, Aug 13 2017

Crossrefs

Programs

  • Mathematica
    {0}~Join~Table[If[AllTrue[#, EvenQ], 0, SelectFirst[Reverse@ #, OddQ]] &@ Most@ Rest@ NestWhileList[If[EvenQ@ #, #/2, (3 # + 1)/2] &, n, # > 1 &], {n, 2, 113}] (* Michael De Vlieger, Aug 14 2017 *)
  • PARI
    a(n)=my(k); if(n%2, n=3*n+1); n>>=valuation(n,2); if(n==1, return(0)); k=n; while(1, n+=(n+1)>>1; n>>=valuation(n,2); if(n==1, return(k), k=n)) \\ Charles R Greathouse IV, Aug 14 2017
  • Scheme
    (define (A237660 n) (let loop ((n (A014682 n)) (last-odd 0)) (if (= 1 n) last-odd (loop (A014682 n) (if (odd? n) n last-odd)))))
    (define (A014682 n) (if (even? n) (/ n 2) (/ (+ n n n 1) 2)))
    ;; Antti Karttunen, Aug 13 2017
    

Extensions

Edited by N. J. A. Sloane, Feb 20 2014
Showing 1-2 of 2 results.