OFFSET
1,1
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
MathWorld, Pairing Function
PROG
(PARI)
A001511(n) = (1+valuation(n, 2));
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
for(n=1, 10000, write("b286251.txt", n, " ", A286251(n)));
(Scheme) (define (A286251 n) (* (/ 1 2) (+ (expt (+ (A001511 (+ 1 n)) (A046523 n)) 2) (- (A001511 (+ 1 n))) (- (* 3 (A046523 n))) 2)))
(Python)
from sympy import factorint
def a001511(n): return 2 + bin(n - 1)[2:].count("1") - bin(n)[2:].count("1")
def T(n, m): return ((n + m)**2 - n - 3*m + 2)/2
def P(n):
f = factorint(n)
return sorted([f[i] for i in f])
def a046523(n):
x=1
while True:
if P(n) == P(x): return x
else: x+=1
def a(n): return T(a001511(n + 1), a046523(n)) # Indranil Ghosh, May 07 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 07 2017
STATUS
approved