%I #12 Feb 28 2024 06:20:17
%S 3,5,13,85,221,1445,3757,24565,63869,417605,1085773,7099285,18458141,
%T 120687845,313788397,2051693365,5334402749,34878787205,90684846733,
%U 592939382485,1541642394461,10079969502245,26207920705837,171359481538165,445534651999229,2913111186148805
%N A sequence a(n) such that a(n+1)^2 - a(n)^2 are perfect squares.
%C The lexically smallest sequence with a(n+1)^2-a(n)^2 representing perfect squares is A018928.
%C This version here is constructed via a(n+1) = a(n)* sqrt( 1+((p^2-1)/(2p))^2) where p = A020639(a(n)) is the smallest prime divisor of the previous term.
%e After a(1)=3, p=3 (again) and a(2) = 3*sqrt(1+ (8/6)^2) = 5.
%e After a(4)=85, p=5 and a(5) = 85*sqrt(1+ (24/10)^2) = 85*sqrt(169/25) = 221.
%p A020639 := proc(n) min(op(numtheory[factorset](n))) ; end proc:
%p A180313 := proc(n) option remember; if n = 1 then 3; else aprev := procname(n-1) ; p := A020639(aprev) ; aprev* sqrt(1+((p^2-1)/2/p)^2) ; end if; end proc:
%p for n from 1 to 30 do printf("%d,",A180313(n)) ; end do: # R. J. Mathar, Sep 23 2010
%t spd[n_] := FactorInteger[n][[1, 1]];
%t a[n_] := a[n] = If[n == 1, 3, aprev = a[n-1];
%t p = spd[aprev]; aprev*Sqrt[1+((p^2-1)/2/p)^2]];
%t Table[a[n], {n, 1, 26}] (* _Jean-François Alcover_, Feb 28 2024, after _R. J. Mathar_ *)
%o (Perl) # use 5.12.0; use warnings; use Math::Prime::TiedArray; tie my @primes, 'Math::Prime::TiedArray';
%o sub SmallestPrimeDivisor ($) { my ($n) = @_; for my $p (@primes) { if ($n % $p == 0) { return $p; } } }
%o sub FindIncrement ($) { my ($n) = @_; my $p = SmallestPrimeDivisor $n; my $k = $n / $p; return $k * ($p ** 2 - 1) / 2; }
%o my $n = 3; say $n; for my $i (0 .. 23) { my $d = FindIncrement $n; $n = sqrt($d ** 2 + $n ** 2); say $n; }
%K nonn
%O 1,1
%A Valentin Tiriac (valtron2000(AT)gmail.com), Aug 26 2010
%E Nomenclature normalized by _R. J. Mathar_, Sep 23 2010
%E Corrected indexing error introduced with previous edit - _R. J. Mathar_, Oct 01 2010