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.

A285332 a(0) = 1, a(1) = 2, a(2n) = A019565(a(n)), a(2n+1) = A065642(a(n)).

This page as a plain text file.
%I A285332 #76 Jan 07 2025 12:43:55
%S A285332 1,2,3,4,6,9,5,8,15,12,14,27,10,25,7,16,210,45,35,18,105,28,462,81,21,
%T A285332 20,154,125,30,49,11,32,10659,420,910,75,78,175,33,24,3094,315,385,56,
%U A285332 780045,924,374,243,110,63,55,40,4389,308,170170,625,1155,60,286,343,42,121,13,64,54230826,31977,28405,630,1330665,1820,714
%N A285332 a(0) = 1, a(1) = 2, a(2n) = A019565(a(n)), a(2n+1) = A065642(a(n)).
%C A285332 Note the indexing: the domain starts from 0, while the range excludes zero.
%C A285332 This sequence can be represented as a binary tree. Each left hand child is produced as A019565(n), and each right hand child as A065642(n), when the parent node contains n >= 2:
%C A285332                                      1
%C A285332                                      |
%C A285332                   ...................2...................
%C A285332                  3                                       4
%C A285332        6......../ \........9                   5......../ \........8
%C A285332       / \                 / \                 / \                 / \
%C A285332      /   \               /   \               /   \               /   \
%C A285332     /     \             /     \             /     \             /     \
%C A285332   15       12         14       27         10       25          7       16
%C A285332 210 45   35  18    105  28  462  81     21  20  154  125     30 49   11  32
%C A285332 etc.
%C A285332 Where will 38 appear in this tree? It is a reasonable assumption that by iterating A087207 starting from 38, as A087207(38) = 129, A087207(129) = 8194, A087207(8194) = 1501199875790187, ..., we will eventually hit a prime A000040(k), most likely with a largish index k. This prime occurs at the penultimate edge at right, as a(A000918(k)) = a((2^k)-2), and thus 38 occurs somewhere below it as a(m) = 38, m > k. All the numbers that share prime factors with 38, namely 76, 152, 304, 608, 722, ..., occur similarly late in this tree, as they form the rightward branch starting from 38. Alternatively, by iterating A285330 (each iteration moves one step towards the root) starting from 38, we might instead first hit some power of 3, or say, one of the terms of A033845 (the rightward branch starting from 6), in which case the first prime encountered would be a(2)=3 and 38 would appear on the left-hand side instead of the right-hand side subtree.
%C A285332 As long as it remains conjecture that A019565 has no cycles, it is certainly also an open question whether this is a permutation of the natural numbers: If A019565 has any cycles, then neither any of the terms in those cycles nor any A065642-trajectories starting from those terms (that is, numbers sharing same prime factors) may occur in this tree.
%C A285332 Sequence exhibits some outrageous swings, for example, a(703) = 224, but a(704) is 1427 decimal digits (4739 binary digits) long, thus it no longer fits into a b-file.
%C A285332 However, the scatter plot of A286543 gives some flavor of the behavior of this sequence even after that point. - _Antti Karttunen_, Dec 25 2017
%H A285332 Antti Karttunen, <a href="/A285332/b285332.txt">Table of n, a(n) for n = 0..703</a>
%H A285332 Michael De Vlieger, <a href="/A285332/a285332.png">Diagram of the binary tree</a> of a(n) showing 1 <= n <= 2^8.
%H A285332 Antti Karttunen and David J. Seal, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2017-June/017705.html">Discussion on SeqFan mailing list</a>
%H A285332 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A285332 a(0) = 1, a(1) = 2, a(2n) = A019565(a(n)), a(2n+1) = A065642(a(n)).
%F A285332 For n >= 0, a(2^n) = A109162(2+n). [The left edge of the tree.]
%F A285332 For n >= 0, a(A000225(n)) = A000079(n). [Powers of 2 occur at the right edge of the tree.]
%F A285332 For n >= 2, a(A000918(n)) = A000040(n). [And the next vertices inwards contain primes.]
%F A285332 For n >= 2, a(A036563(1+n)) = A001248(n). [Whose right children are their squares.]
%F A285332 For n >= 0, a(A055010(n)) = A000244(n). [Powers of 3 are at the rightmost edge of the left subtree.]
%F A285332 For n >= 2, a(A129868(n-1)) = A062457(n).
%F A285332 A048675(a(n)) = A285333(n).
%F A285332 A046523(a(n)) = A286542(n).
%t A285332 Block[{a = {1, 2}}, Do[AppendTo[a, If[EvenQ[i], Times @@ Prime@ Flatten@ Position[#, 1] &@ Reverse@ IntegerDigits[a[[i/2 + 1]], 2], If[# == 1, 1, Function[{n, c}, SelectFirst[Range[n + 1, n^2], Times @@ FactorInteger[#][[All, 1]] == c &]] @@ {#, Times @@ FactorInteger[#][[All, 1]]}] &[a[[(i - 1)/2 + 1]] ] ]], {i, 2, 70}]; a] (* _Michael De Vlieger_, Mar 12 2021 *)
%o A285332 (PARI)
%o A285332 A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ This function from _M. F. Hasler_
%o A285332 A007947(n) = factorback(factorint(n)[, 1]); \\ From _Andrew Lelechenko_, May 09 2014
%o A285332 A065642(n) = { my(r=A007947(n)); if(1==n,n,n = n+r; while(A007947(n) <> r, n = n+r); n); };
%o A285332 A285332(n) = { if(n<=1,n+1,if(!(n%2),A019565(A285332(n/2)),A065642(A285332((n-1)/2)))); };
%o A285332 for(n=0, 4095, write("b285332.txt", n, " ", A285332(n)));
%o A285332 (Scheme)
%o A285332 ;; With memoization-macro definec.
%o A285332 (definec (A285332 n) (cond ((<= n 1) (+ n 1)) ((even? n) (A019565 (A285332 (/ n 2)))) (else (A065642 (A285332 (/ (- n 1) 2))))))
%o A285332 (Python)
%o A285332 from operator import mul
%o A285332 from sympy import prime, primefactors
%o A285332 def a007947(n): return 1 if n<2 else reduce(mul, primefactors(n))
%o A285332 def a019565(n): return reduce(mul, (prime(i+1) for i, v in enumerate(bin(n)[:1:-1]) if v == '1')) if n > 0 else 1 # This function from _Chai Wah Wu_
%o A285332 def a065642(n):
%o A285332     if n==1: return 1
%o A285332     r=a007947(n)
%o A285332     n = n + r
%o A285332     while a007947(n)!=r:
%o A285332         n+=r
%o A285332     return n
%o A285332 def a(n):
%o A285332     if n<2: return n + 1
%o A285332     if n%2==0: return a019565(a(n//2))
%o A285332     else: return a065642(a((n - 1)//2))
%o A285332 print([a(n) for n in range(51)]) # _Indranil Ghosh_, Apr 18 2017
%Y A285332 Inverse: A285331.
%Y A285332 Cf. A007947, A019565, A033845, A048675, A065642, A087207, A109162, A285319, A285320, A285328, A285330, A285333, A286542, A286543.
%Y A285332 Compare also to permutation A285112 and array A285321.
%K A285332 nonn,tabf
%O A285332 0,2
%A A285332 _Antti Karttunen_, Apr 17 2017