Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
public class FibonacciSequence {
public static void main(String args[]){
int sum = 0;
int a = 1;
int b = 2;
int c = 3;
/**
* 求偶数之和
* 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
* a, b, c
* a, b, c
* a, b, c
* a, b, c
* */
while (b < 4000000){
sum += b;
a = b + c;
b = a + c;
c = a + b;
}
System.out.println(sum);
}
}
分享到:
相关推荐
Topological Spaces: Including a Treatment of Multi-Valued Functions, Vector Spaces and Convexity Topological Spaces: Including a Treatment of Multi-Valued Functions, Vector Spaces and Convexity ...
Hjørungnes教授是挪威奥斯陆大学数学和自然科学学院的教授,同时也是IEEE Transactions on Wireless Communications的编辑,以及IEEE Journal of Selected Topics in Signal Processing和IEEE Journal on Selected ...
### Chan Active Contours without Edges for Vector-Valued Images #### 概述 本文献《Active Contours without Edges for Vector-Valued Images》由Tony F. Chan、B. Yezrielev Sandberg 和 Luminita A. Vese ...
Statistical SIgnal processing of complex-valued data: the theory
Using the method of maximizing deviations to multiple attribute decision making under interval-valued intuitionistic fuzzy environment,卫贵武,,With respect to multiple attribute decision making ...
在内容中提到的关键词“Lagrangestability”(拉格朗日稳定性)、“Complex-valued neural networks”(复值神经网络)、“Time delays”(时滞)以及“Matrix measure”(矩阵测度)是研究复值时滞神经网络稳定性时...
欧拉公式求长期率的matlab代码欧拉计划问题与解决方案 这是一个用于存储网站问题解决方案的存储库。 要讨论/查看针对特定问题的各种解决方案,请分叉此存储库,并发送提及该解决方案的请求...even-valued terms. '''
彭飞和冯敏两位学者在他们开创性的论文《A Generalization of Subdifferential for Set-Valued Mappings》中,提出了一种新的广义次微分概念,并在此基础上做出了深入的研究和理论拓展。 传统的次微分理论最初由...
本文是关于在复数域中研究实值函数的极值点的数学工具书。复数域导数是数学分析中一个重要的概念,它不仅涉及一元复变函数的基本理论,还与计算机科学和工程领域中的机器学习、深度学习等技术紧密相关。...
spective they are the key in the context of Gaussian processes, where the kernel function is known as the covariance function. Traditionally, kernel methods have been used in supervised learning ...
abbreviated 3VL) is any of several many-valued logic systems in which there are three truth values indicating true, false and some indeterminate third value. This is contrasted with the more commonly ...
四值逻辑是一种扩展了传统二值逻辑的逻辑系统,传统二值逻辑中只存在“真”和“假”两个值,而四值逻辑中引入了额外的值来表达更复杂的情况。四值逻辑在处理一些特定问题时,特别是在常识知识、自然语言和哲学领域内...
标题中提到的“复值递归神经网络多平衡点的稳定性与吸引域”是本文研究的主题。复值神经网络与传统的实值神经网络相比,它们在复数域内处理信息,这在某些应用中可以提供更丰富的表达能力和更有效的计算方式。...
Are Hjørungnes教授任职于挪威奥斯陆大学的数学与自然科学学院,在《IEEE Transactions on Wireless Communications》杂志担任编辑,并曾作为客座编辑服务于《IEEE Journal of Selected Topics in Signal ...
《Complex-Valued Neural Networks》是由Akira Hirose编著的一本专业书籍,专注于探讨复值神经网络(Complex-Valued Neural Networks,简称CVNNs)的理论与应用。复值神经网络是一种特殊的神经网络模型,它在神经元...
Interval-Valued Intuitionistic Fuzzy Sets (Krassimir T. Atanassov)
Abstract This chapter contains sections titled: Introduction Derivatives in Wirtinger Calculus Complex Gradient Learning Algorithms for Feedforward CVNNs Learning Algorithms for Recurrent CVNNs ...