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.

A286242 Compound filter: a(n) = P(A278222(n), A278219(n)), where P(n,k) is sequence A000027 used as a pairing function.

This page as a plain text file.
%I A286242 #12 Feb 16 2025 08:33:44
%S A286242 1,5,12,14,12,84,40,44,12,142,216,183,40,265,86,152,12,142,826,265,
%T A286242 216,1860,607,489,40,832,607,1117,86,619,226,560,12,142,826,265,826,
%U A286242 5080,2497,619,216,2956,4308,4155,607,8575,1105,1533,40,832,2497,2116,607,5731,4501,3475,86,1402,1105,3475,226,1759,698,2144,12,142,826,265,826,5080,2497,619,826
%N A286242 Compound filter: a(n) = P(A278222(n), A278219(n)), where P(n,k) is sequence A000027 used as a pairing function.
%H A286242 Antti Karttunen, <a href="/A286242/b286242.txt">Table of n, a(n) for n = 0..16383</a>
%H A286242 MathWorld, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing Function</a>
%F A286242 a(n) = (1/2)*(2 + ((A278222(n)+A278219(n))^2) - A278222(n) - 3*A278219(n)).
%F A286242 a(n) = (1/2)*(2 + ((A278222(n)+A278222(A003188(n)))^2) - A278222(n) - 3*A278222(A003188(n))).
%o A286242 (PARI)
%o A286242 A003188(n) = bitxor(n, n>>1);
%o A286242 A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t }; \\ Modified from code of _M. F. Hasler_
%o A286242 A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ This function from _Charles R Greathouse IV_, Aug 17 2011
%o A286242 A278222(n) = A046523(A005940(1+n));
%o A286242 A278219(n) = A278222(A003188(n));
%o A286242 A286242(n) = (2 + ((A278222(n)+A278219(n))^2) - A278222(n) - 3*A278219(n))/2;
%o A286242 for(n=0, 16383, write("b286242.txt", n, " ", A286242(n)));
%o A286242 (Scheme) (define (A286242 n) (* (/ 1 2) (+ (expt (+ (A278222 n) (A278219 n)) 2) (- (A278222 n)) (- (* 3 (A278219 n))) 2)))
%o A286242 (Python)
%o A286242 from sympy import prime, factorint
%o A286242 import math
%o A286242 def T(n, m): return ((n + m)**2 - n - 3*m + 2)/2
%o A286242 def A(n): return n - 2**int(math.floor(math.log(n, 2)))
%o A286242 def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))
%o A286242 def a005940(n): return b(n - 1)
%o A286242 def P(n):
%o A286242     f=factorint(n)
%o A286242     return sorted([f[i] for i in f])
%o A286242 def a046523(n):
%o A286242     x=1
%o A286242     while True:
%o A286242         if P(n) == P(x): return x
%o A286242         else: x+=1
%o A286242 def a003188(n): return n^(n>>1)
%o A286242 def a243353(n): return a005940(1 + a003188(n))
%o A286242 def a278219(n): return a046523(a243353(n))
%o A286242 def a278222(n): return a046523(a005940(n + 1))
%o A286242 def a(n): return T(a278222(n), a278219(n)) # _Indranil Ghosh_, May 07 2017
%Y A286242 Cf. A000027, A003188, A278219, A278222, A286240, A286241, A286242.
%K A286242 nonn
%O A286242 0,2
%A A286242 _Antti Karttunen_, May 07 2017