找回密码
 欢迎注册
楼主: 王守恩

[推荐] 会出现规律吗?

[复制链接]
发表于 4 天前 | 显示全部楼层
northwolves 发表于 2025-1-12 17:10
(PARI) a(n)=t=sqrtint(n); if((n-t*t)%2==0, (n-t*t)/2, ((t+1)^2-n)/2) \\ Ralf Stephan, Sep 23 2013

  1. a[n_] :=Block[{t = Floor@Sqrt@n, s = n - t^2},  If[EvenQ[s], s/2, t + (1 - s)/2]];
  2. Table[a[n], {n, 0, 100}]
复制代码


{0,0,1,1,0,2,1,1,2,0,3,1,2,2,1,3,0,4,1,3,2,2,3,1,4,0,5,1,4,2,3,3,2,4,1,5,0,6,1,5,2,4,3,3,4,2,5,1,6,0,7,1,6,2,5,3,4,4,3,5,2,6,1,7,0,8,1,7,2,6,3,5,4,4,5,3,6,2,7,1,8,0,9,1,8,2,7,3,6,4,5,5,4,6,3,7,2,8,1,9,0}
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

小黑屋|手机版|数学研发网 ( 苏ICP备07505100号 )

GMT+8, 2025-1-18 13:08 , Processed in 0.021276 second(s), 14 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表