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.

A078440 Numbers n with property that n is not a power of 2 and the finite sequence n, f(n), f(f(n)), ...., 1 in the Collatz (or 3x + 1) problem contains exactly one prime. (The earliest "1" is meant.)

This page as a plain text file.
%I A078440 #22 Feb 16 2025 08:32:48
%S A078440 21,42,84,85,168,170,336,340,341,453,672,680,682,906,909,1344,1360,
%T A078440 1364,1365,1812,1813,1818,2688,2720,2728,2730,3624,3626,3636,5376,
%U A078440 5440,5456,5460,5461,7248,7252,7272,7281,9669
%N A078440 Numbers n with property that n is not a power of 2 and the finite sequence n, f(n), f(f(n)), ...., 1 in the Collatz (or 3x + 1) problem contains exactly one prime. (The earliest "1" is meant.)
%C A078440 f(n) = n/2 if n is even, = 3n + 1 if n is odd. Powers 2^n trivially have exactly one prime in n, f(n), f(f(n)), ..., 2, 1, namely 2 and so are excluded from the sequence.
%C A078440 A055509(a(n)) = 0; A078350(a(n)) <= 1.
%H A078440 Reinhard Zumkeller, <a href="/A078440/b078440.txt">Table of n, a(n) for n = 1..1000</a>
%H A078440 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/CollatzProblem.html">Collatz Problem</a>
%H A078440 Wikipedia, <a href="http://en.wikipedia.org/wiki/Collatz_conjecture">Collatz conjecture</a>
%H A078440 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%e A078440 n, f(n), f(f(n)), .... for n = 21 is: 21, 64, 32, 16, 8, 4, 2, 1, which has exactly one prime, that is, 2. Hence 21 belongs to the sequence.
%t A078440 f[n_] := n/2 /; Mod[n, 2] == 0 f[n_] := 3 n + 1 /; Mod[n, 2] == 1 g[n_] := Module[{i, p}, i = n; p = 0; While[i > 1, If[PrimeQ[i], p = p + 1]; i = f[i]]; p]; Select[Range[10^4], g[ # ] == 1 && ! IntegerQ[Log[2, # ]] &]
%t A078440 pQ[n_]:=Count[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n, #>1&], _?PrimeQ] == 1; With[ {nn=10000},Complement[Select[Range[nn],pQ],2^Range[Floor[ Log[ 2,nn]]]]] (* _Harvey P. Dale_, Oct 19 2011 *)
%o A078440 (Haskell)
%o A078440 a078440 n = a078440_list !! (n-1)
%o A078440 a078440_list = filter notbp a196871_list where
%o A078440    notbp x = m > 0 && x > 1 || m == 0 && notbp x' where
%o A078440       (x',m) = divMod x 2
%o A078440 -- _Reinhard Zumkeller_, Oct 08 2011
%Y A078440 A006370; subsequence of A196871 (with binary powers).
%K A078440 nonn
%O A078440 1,1
%A A078440 _Joseph L. Pe_, Dec 31 2002