# [seqfan] Re: some gp/pari code in OEIS returns rationals, not integers

Joerg Arndt arndt at jjj.de
Thu Mar 12 01:14:18 CET 2009

```* Gottfried Helms <Annette.Warlich at t-online.de> [Mar 12. 2009 10:34]:
> Am 11.03.2009 15:45 schrieb Georgi Guninski:
> > some gp/pari code in OEIS returns rationals, not integers
> >
> > A004738 - often
> > A079352 - at least for a(1)
> > A093356 - at least for a(1)
> >
> Not only the first, but also the second Pari-program does not work
> (If I copy&paste it into Pari/GP). What's going on here?
>
> Gottfried
>

A004738 Concatenation of sequences (1,2,..,n-1,n,n-1,..,2) for n >= 2.

works for me:

?  a(n)= floor(sqrt(n)+1/2)+1-abs(n-1-(floor(sqrt(n)+1/2))^2)
? vector(20,j,a(j))
[1, 2, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2]

... and this one "works" as well:

? a(n)= floor(sqrt(n)+1/2)+1-abs(n-1-(floor(sqrt(n)+1/2)-1/2)^2)
? vector(20,j,a(j))
[7/4, 5/4, 11/4, 9/4, 5/4, 1/4, 15/4, 13/4, 9/4, \
5/4, 1/4, -3/4, 19/4, 17/4, 13/4, 9/4, 5/4, 1/4, -3/4, -7/4]

uuuh, Smarandache...

Check the "key words" on page 5 of (note : 7 Megabytes)
http://www.gallup.unm.edu/~smarandache/CP2.pdf