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.

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

This page as a plain text file.
%I A286252 #12 Feb 16 2025 08:33:44
%S A286252 1,5,2,18,2,23,7,59,2,23,16,94,7,80,29,195,2,23,16,94,16,467,67,355,7,
%T A286252 80,67,706,29,302,121,672,2,23,16,94,16,467,67,355,16,467,436,1894,67,
%U A286252 1832,277,1331,7,80,67,706,67,1832,631,2779,29,302,277,2704,121,1178,497,2422,2,23,16,94,16,467,67,355,16,467,436,1894,67,1832,277,1331,16,467,436
%N A286252 Compound filter: a(n) = P(A001511(1+n), A278222(n)), where P(n,k) is sequence A000027 used as a pairing function.
%H A286252 Antti Karttunen, <a href="/A286252/b286252.txt">Table of n, a(n) for n = 0..16384</a>
%H A286252 MathWorld, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing Function</a>
%F A286252 a(n) = (1/2)*(2 + ((A001511(1+n)+A278222(n))^2) - A001511(1+n) - 3*A278222(n)).
%o A286252 (PARI)
%o A286252 A001511(n) = (1+valuation(n,2));
%o A286252 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 A286252 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 A286252 A278222(n) = A046523(A005940(1+n));
%o A286252 A286252(n) = (2 + ((A001511(1+n)+A278222(n))^2) - A001511(1+n) - 3*A278222(n))/2;
%o A286252 for(n=0, 16384, write("b286252.txt", n, " ", A286252(n)));
%o A286252 (Scheme) (define (A286252 n) (* (/ 1 2) (+ (expt (+ (A001511 (+ 1 n)) (A278222 n)) 2) (- (A001511 (+ 1 n))) (- (* 3 (A278222 n))) 2)))
%o A286252 (Python)
%o A286252 from sympy import prime, factorint
%o A286252 import math
%o A286252 def T(n, m): return ((n + m)**2 - n - 3*m + 2)/2
%o A286252 def A(n): return n - 2**int(math.floor(math.log(n, 2)))
%o A286252 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 A286252 def a005940(n): return b(n - 1)
%o A286252 def P(n):
%o A286252     f = factorint(n)
%o A286252     return sorted([f[i] for i in f])
%o A286252 def a046523(n):
%o A286252     x=1
%o A286252     while True:
%o A286252         if P(n) == P(x): return x
%o A286252         else: x+=1
%o A286252 def a278222(n): return a046523(a005940(n + 1))
%o A286252 def a001511(n): return 2 + bin(n - 1)[2:].count("1") - bin(n)[2:].count("1")
%o A286252 def a(n): return T(a001511(n + 1), a278222(n)) # _Indranil Ghosh_, May 07 2017
%Y A286252 Cf. A000027, A001511, A278222, A286162, A286251, A286253, A286254.
%K A286252 nonn
%O A286252 0,2
%A A286252 _Antti Karttunen_, May 07 2017