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.

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

This page as a plain text file.
%I A286240 #17 Feb 16 2025 08:33:44
%S A286240 2,5,12,14,23,42,59,44,23,61,142,117,109,183,261,152,23,61,142,148,
%T A286240 601,850,607,375,109,265,1093,939,473,765,1097,560,23,61,142,148,601,
%U A286240 850,607,430,601,1741,3946,2545,2497,3463,2509,1323,109,265,1093,1117,2497,4525,5707,3153,473,1105,4489,3813,1969,3129,4497,2144,23,61,142,148,601,850,607,430,601,1741
%N A286240 Compound filter: a(n) = P(A278222(n), A278222(1+n)), where P(n,k) is sequence A000027 used as a pairing function.
%H A286240 Antti Karttunen, <a href="/A286240/b286240.txt">Table of n, a(n) for n = 0..16383</a>
%H A286240 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing Function</a>
%F A286240 a(n) = (1/2)*(2 + ((A278222(n)+A278222(1+n))^2) - A278222(n) - 3*A278222(1+n)).
%o A286240 (PARI)
%o A286240 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 A286240 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 A286240 A278222(n) = A046523(A005940(1+n));
%o A286240 A286240(n) = (2 + ((A278222(n)+A278222(1+n))^2) - A278222(n) - 3*A278222(1+n))/2;
%o A286240 for(n=0, 16383, write("b286240.txt", n, " ", A286240(n)));
%o A286240 (Scheme) (define (A286240 n) (* (/ 1 2) (+ (expt (+ (A278222 n) (A278222 (+ 1 n))) 2) (- (A278222 n)) (- (* 3 (A278222 (+ 1 n)))) 2)))
%o A286240 (Python)
%o A286240 from sympy import prime, factorint
%o A286240 import math
%o A286240 def T(n, m): return ((n + m)**2 - n - 3*m + 2)/2
%o A286240 def A(n): return n - 2**int(math.floor(math.log(n, 2)))
%o A286240 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 A286240 def a005940(n): return b(n - 1)
%o A286240 def P(n):
%o A286240     f = factorint(n)
%o A286240     return sorted([f[i] for i in f])
%o A286240 def a046523(n):
%o A286240     x=1
%o A286240     while True:
%o A286240         if P(n) == P(x): return x
%o A286240         else: x+=1
%o A286240 def a278222(n): return a046523(a005940(n + 1))
%o A286240 def a(n): return T(a278222(n), a278222(n + 1)) # _Indranil Ghosh_, May 07 2017
%Y A286240 Cf. A000027, A278222, A286241, A286242, A286255.
%Y A286240 Cf. A088705 (one of the matches not matched by A278222 alone. Thus also the whole A007814 (A001511) family is included).
%K A286240 nonn
%O A286240 0,1
%A A286240 _Antti Karttunen_, May 07 2017