A255361 Number of ways n can be represented as x*y+x+y where x>=y>1.
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 2, 1, 0, 1, 1, 0, 2, 0, 1, 1, 0, 1, 3, 0, 0, 1, 2, 0, 2, 0, 1, 2, 0, 0, 3, 1, 1, 1, 1, 0, 2, 1, 2, 1, 0, 0, 4, 0, 0, 2, 2, 1, 2, 0, 1, 1, 2, 0, 4, 0, 0, 2, 1, 1, 2, 0, 3, 2, 0, 0, 4, 1, 0, 1, 2, 0, 4, 1, 1, 1, 0, 1, 4, 0, 1, 2, 3, 0, 2, 0, 2, 3, 0
Offset: 0
Keywords
Examples
8 = 2*2 + 2 + 2, this is the only representation, so a(8)=1. 23 = 2*7 + 2 + 7 = 3*5 + 3 + 5, two representations, so a(23)=2.
Links
- Antti Karttunen, Table of n, a(n) for n = 0..3300
Programs
-
Mathematica
a[n_] := (r = Reduce[x >= y > 1 && n == x*y + x + y, {x, y}, Integers]; Which[r[[0]] === And, 1, r[[0]] === Or, Length[r], True, 0]); Table[a[n], {n, 0, 105}] (* Jean-François Alcover, Jan 23 2018 *)
-
PARI
a(n) = {nb = 0; for (y=2, n\2, for (x=y, n\2, nb += ((x*y+x+y) == n););); nb;} \\ Michel Marcus, Feb 22 2015
-
Python
TOP = 1000 a = [0]*TOP for y in range(2, TOP//2): for x in range(y, TOP//2): k = x*y + x + y if k>=TOP: break a[k]+=1 print(a)
-
Python
from sympy import divisor_count def A255361(n): return int((divisor_count(n+1)-1>>1)-(n&1)) if n!=1 else 0 # Chai Wah Wu, Oct 15 2024
Formula
Let d = A000005; then a(n) = floor((d(n+1) - 1)/2) for even n and a(n) = floor((d(n+1) - 3) / 2) for odd n>1. - Ivan Neretin, Sep 07 2015
Extensions
More terms from Antti Karttunen, Sep 22 2017