OFFSET
1,2
COMMENTS
{a(n)} gives all positive fourth powers modulo all powers of 2, that is, positive fourth powers over 2-adic integers. So this sequence is closed under multiplication.
LINKS
Jianing Song, Table of n, a(n) for n = 1..10002 (all terms <= 150000)
FORMULA
a(n) = 15*n + O(log(n)).
PROG
(PARI) isA319281(n)= n\16^valuation(n, 16)%16==1
(Python)
def A319281(n):
if n<3: return 15*n-14
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
kmin = kmax >> 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
def f(x): return n-1+x-sum((((x>>(i<<2))-1)>>4)+1 for i in range(x.bit_length()>>2))
return bisection(f, n, n) # Chai Wah Wu, Feb 17 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Jianing Song, Sep 16 2018
STATUS
approved